Saturday, 16 October 2010

How do I reference the row or column of a category in the category list, with css.

The category list is generated in the file includes/modules/category_row.php

If you change the line starting $list_box_contents[$row][$col] to

$list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . '', 'text' => '<div class="categorybox colbox'.$col.' rowbox'.$row.'"><a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '"><span class="categoryimage">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '</span><span class="categorynamex">' . $categories->fields['categories_name'] . '</span></a></div>');

Then this provides new classes to reference -
categorybox = the image and title
categoryimage = the image
categorynamex = the title

It also provides two classes which change depending on the row or column you are in.

colbox0 is applied to the category of every first column element,
colbox1 is applied to the second etc.

rowbox0, rowbox1... is the same, but with the rows.

No comments:

Post a Comment