_listItemStart- adding class

3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 26, 2011   (RSS)

By rez - August 25, 2011 - edited: August 25, 2011

When using

<?php echo $categoryRecord['_listItemStart'] ?>

is it possible to add a class to the <li> to end up with:

<li class="blue">

Re: [rez] _listItemStart- adding class

By robin - August 26, 2011

Hey Rez,

You can generally just use your own <li>. There is also an advanced option for getRecords to set <li> attributes called 'liAttributesCallback', but it's probably more work then is worth it just to set "<li class="blue">". I"ve put the getCategories options below for reference.

Hope that helps,
Robin

list($categoryRecords, $selectedCategory) = getCategories(array(
'tableName' => 'category', // REQUIRED
'rootCategoryNum' => '0', // Only categories _below_ this one will be shown (defaults to 0 for all)
'defaultCategory' => 'first', // Enter 'first', a category number, or leave blank '' for none
'ulAttributes' => " class='muList' ", // add html attributes to <ul> tags
'selectedCategoryNum' => '', // defaults to getLastNumberInUrl()
'categoryFormat' => 'showall', // showall, onelevel, twolevel, breadcrumb
'loadCreatedBy' => false, // optional, defaults to false, adds createdBy. fields for created user
'ignoreHidden' => false, // don't hide records with hidden flag set

'ulAttributesCallback' => 'myUlAttr', // ADVANCED: custom function to return ul attributes, eg: myUlAttr($category);
'liAttributesCallback' => 'myLiAttr', // ADVANCED: custom function to return li attributes, eg: myLiAttr($category);

));

Robin
Programmer
interactivetools.com