Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-04-05 20:43:46

vineonardo
Member
Registered: 2011-08-31
Posts: 128
Website

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

#2 2013-04-05 22:00:20

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

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

#3 2013-04-06 04:30:44

vineonardo
Member
Registered: 2011-08-31
Posts: 128
Website

Re: Achieving unusual section, category & article hierarchy - possible?

Thanks Oleg, I will give it a try.
Thank you very much.

Offline

Board footer

Powered by FluxBB