I am trying to add a custom style to each list item within Joomla!s Category List output which gives me the following html
<div class="blog">
<div class="cat-children">
<ul>
<li class="first">
<span class="item-title"><a href="/hyt-hand-held-license-free">HYT</a>
</span>
</li>
<li></li>
</ul>
</div>
</div>
I think what I need to do is add something like:
<li id="myID<?php echo $this->item->catid; ?> ">
The trouble is I can't find which file to override. I have looked in /templates/mytemplate/html/com_content/category/
as well as /components/com_content/views/category/tmpl
yet none of the files seem to have a an unordered list within them that relates to cat-chidren
.
So my first question is which file should I edit? And my second is what is the best syntax of this->item->[correct'Method'?]
(is method the correct term or variable, I'm a little shaky on this!) to use so that each list item will have an id="myID[nameofarticle/subcatagory]"
You'll see cat-children in /components/com_content/views/category/tmpl/default.php
The ul is in another loaded subtemplate, loadTemplate('children'); ?> , i.e.
/components/com_content/views/category/tmpl/default_children.php
If you want to modify the li class you could stick something like this at line 26 (of your override not core file - but fine to just test on a core file)
<?php $class = ' class="cmyId' . $this->escape($child->title) . '"';?>
That would make each li appear as
So this
<li<?php echo $class; ?>>
<?php $class = ''; ?>
becomes this
<?php $class = ' class="cmyId' . $this->escape($child->title) . '"';?>
<li<?php echo $class; ?>>
<?php //$class = ''; ?>
Have tested it out on a 2.5 installation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With