I have this code that I want to insert a div clear class the it reaches the 5th column:
<div class="grid<?php $count++; if ($count == 5) ?>">
<?php if ($count == 5) { $count = 0; echo '<div class="clearit"></div>'; } ?>
It works but I am getting this error that I want to get rid of:
Notice: Undefined variable: count in....template/catalog/product/layout.phtml on line 40
where line 40 is <div class="grid<?php $count++; if ($count == 5) ?>">
I can’t tell where has gone wrong with my limited PHP knowledge
It is because you have not declared your variable. If you add
$count = 0;to the top of your PHP file the error will go away as you have declared the variable.You should also note that this has nothing to do with Zend Framework.