Separate Your Subcategories
broadcasted 11 months ago by Ian Tearle
I came across an issue whilst developing a rather large website for a local church this week, where by a category would show the results for itself and its sub categories, whilst this in some events is not a problem, I wanted to be able to really separate the sub categories from the parent categories.
So here is the solution, though not a perfect one, it does work to separate the items from each other, but because everything is still fetched in the content loop, {_first} operators do not work, as the first item in the array may be in one of the subcategories. A ticket has been raised for the next update of Expanse to find a true work around for this.
Firstly display your content for when you are in a category, loop the content, but before rendering the content set the cid of the item to be 0. i.e. has no sub category id.
{set:category} {loop:content} {set:cid:0}
Once you have looped your content for the category you will need to do the same for when the user is viewing a subcategory, this time you need to use the {mis} variable to show the looped content for the subcategory.
{set:subcategory} {loop:content} {mis:cid:0}
Now you have a way of separating the content between your categories and subcategories.
- Ian Tearle says:
-
testing another comment
Posted On: Friday, October 30th, 2009 @ 11:24 pm
Post A Comment
* Required Fields
No HTML is allowed. All links, and new lines will be automagically converted to HTML for you.
Notice to spammers, all links will be sanitized with rel="nofollow".
2 Comments
Pages: 1
just testing
Posted On: Friday, October 30th, 2009 @ 11:22 pm