(Page List) Add a class after 3 items
Permalink
Hello!
I've been on this for a while and couldn't figure it out:
On a "folio" page I have a PAGE LIST block showing an image and brief description. I have 3 items per row with their respective class. Each 3rd row, I need a class (.last) to appear to keep the container (DIV) from being in the wrong place (Due to float elements and IE).
I believe a php count function would create such event!?
Any responses are greatly appreciated.
I've been on this for a while and couldn't figure it out:
On a "folio" page I have a PAGE LIST block showing an image and brief description. I have 3 items per row with their respective class. Each 3rd row, I need a class (.last) to appear to keep the container (DIV) from being in the wrong place (Due to float elements and IE).
I believe a php count function would create such event!?
Any responses are greatly appreciated.
And a quick followup: The solution above will change ALL of the page lists on your site. If you only want this change to affect SOME of the page lists on your site, you need to copy the page list view.php file to here:
YOURSITE/blocks/page_list/templates/
(instead of YOURSITE/blocks/page_list/)
AND you need to rename it, to something like "three_per_row.php". Then go to the page you want to change the page_list template on and enter edit mode, click on the page list block, choose "Custom Template" from the popup menu, and pick "Three Per Row" from the dropdown menu.
(instead of
YOURSITE/blocks/page_list/templates/
(instead of YOURSITE/blocks/page_list/)
AND you need to rename it, to something like "three_per_row.php". Then go to the page you want to change the page_list template on and enter edit mode, click on the page list block, choose "Custom Template" from the popup menu, and pick "Three Per Row" from the dropdown menu.
(instead of
Thank you for the quick reply jordanlev.
Worked like a charm. I Should of mentioned I had good knowledge of Concrete5 to save you time! :)
Your time and patience is greatly appreciated.
Worked like a charm. I Should of mentioned I had good knowledge of Concrete5 to save you time! :)
Your time and patience is greatly appreciated.
On your server, copy this file:
YOURSITE/concrete/blocks/page_list/view.php
to a new folder you'll create:
YOURSITE/blocks/page_list/
Now edit that newly copied file (YOURSITE/blocks/page_list/view.php) and under this line:
add a new line and put this code in there:
Now you need to alter that template's html a bit to put the classname in. You'll notice that there's no surrounding div around each item -- there's a <h3 class="ccm-page-list-title"> and then a <div class="ccm-page-list-description"> -- so you will probably want to put your own new div around both of those, and put your class in there. You can do so like this:
(and don't forget to put the closing </div> after the closing div for <div class="ccm-page-list-description">).
Hope that makes sense -- let me know if you need more help.
-Jordan