Login | Sign up | Toll-Free: 1-800-752-0455



4 posts by 3 authors in: Forums > CMS Builder Community
Last Post: August 24, 2016

Hi ciaran_mac,

You can use the end() function to get the last array element then add an if statement inside your foreach loop that checks if the current array's num is equal to the last array element's num. If yes, then add the class.


Daryl Maximo
PHP Programmer - interactivetools.com

Try playing around with the css selector of :last-child or :last-of-type.  something like this may work

<ul id="sample">

<?php for each... ?>

<li>Output goes here...</li>

<?php endforeach ?>


- - - -

#sample li:last-of-type { colour: red;}


Tim Forrest
Toledoh Enterprises

Thanks Daryl!