Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Achieving unusual section, category & article hierarchy - possible?
Hello,
I’ve been presented with a requirement where I’ll need to create a product page with several main & sub categories.
Page should only display the articles from the selected category.
It’s a products display website where we need following content hierarchy:
(Section)Products page -> (Category1)Category A -> (Category2)Category A-1 -> (Article)Articles list of all the articles from this category
When the page loads, the user must only see the main categories with a thumbnail(it can be of the first article or something that relates with the category).
After user chooses the main category, he/she should be able to see subcategories with thumbnails, after that, there will be list of articles.
For now, I’ve succeeded in making a static page with all the main categories & after that each category shows the articles posted in that category. But I’m totally clueless on how can I do this dynamically & also for using sub categories too.
I thought of using article_custom tag but I’m not sure that will work.
Thanks for your time.
Offline
Re: Achieving unusual section, category & article hierarchy - possible?
Vineet, assuming you products section and category are named “products”, try this in your page template:
<txp:if_article_list>
<txp:if_section name="products">
<txp:variable name="products">
<txp:category_list parent="products" exclude="products" children="0" break=",">
<txp:category />
</txp:category_list>
</txp:variable>
<txp:if_category name='<txp:variable name="products" />'>
<txp:category_list parent='<txp:category />' exlude='<txp:category />' children="0">
<txp:category link="1" title="1" />
</txp:category_list>
<txp:else />
<txp:if_category>
<txp:article />
<txp:else />
<txp:category_list categories='<txp:variable name="products" />'>
<txp:category link="1" title="1" />
</txp:category_list>
</txp:if_category>
</txp:if_category>
</txp:if_section>
</txp:if_article_list>
This should give you the main structure. If it works, you can replace <txp:category link="1" />
by <txp:article_custom category='<txp:category />' limit="1" />
or something like this.
Offline
Offline