Using the mod_articles_categories module. I am writing an override but want to add a class to each li within foreach().
I have the following code:
foreach ($list as $item) : ?>
<li>
How can I add a class to the li?
Using the mod_articles_categories module. I am writing an override but want to add a class to each li within foreach().
I have the following code:
foreach ($list as $item) : ?>
<li>
How can I add a class to the li?
If you have numbered classes, (someclass_0, someclass_1 etc) you can use something like this:
foreach ($list as $key =>$item) : ?>
<li class="someclass_<?php echo $key ?>">
...
Try this:
<?php
foreach ($list as $item=>$key) : ?>
<li class="sample_<?php echo $key; ?>"> </li>
<?php end foreach ?>