php $count - Undefined variable:

后端 未结 2 723
-上瘾入骨i
-上瘾入骨i 2021-01-22 15:35

I have this code that I want to insert a div clear class the it reaches the 5th column:

\"> <
相关标签:
2条回答
  • 2021-01-22 15:54

    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.

    0 讨论(0)
  • 2021-01-22 16:02

    It is better to do that with CSS and not with markup or server side scripting. Let me give you an example:

    .grid:nth-child(5n+5), .grid.fifth-child { clear: both; }
    

    It's not supported in every browser so you can use jQuery to fix that:

    $('.grid:nth-child(5n+5)').addClass('fifth-child');
    
    0 讨论(0)
提交回复
热议问题