Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Outputing a list of articles for specific category on landing page
I don’t consider myself a noob anymore but i am really struggling with the logic of what seems to me a very simple request.
How to produce a list of articles (not an article list): for specific category on landing page. These articles all need to link to their respective children categories, which in turn produce their list of articles
–main-category
––sub-category
–––sub-sub-category
––––sub-sub-sub-category
––––sub-sub-sub-category
––––sub-sub-sub-category
––––sub-sub-sub-category
<h1>main-category title <txp:category title="1" /></h1>
<ul class="main-category">
<txp:article_custom category="main-category">
<li>
<a href="<txp:permlink"> title="link to sub-category">
<span class="entry-title"><txp:custom_field name="sub-category" /></span>
<txp:article_image />
</a>
</li>
</txp:article>
</ul>
The article_custom tag outputs nothing?? which seems illogical to me. Why is this?
Last edited by Timid&friendly (2010-05-30 08:50:14)
I think, therefore I AM, … … er … I think :-?
Offline
Re: Outputing a list of articles for specific category on landing page
Hi
I think there is an error on your code, because you end it wit txp:article instead of article_custom
but your code will only output articles in main_category and not in subcat!
to do what you want you must use txp:category_list above txp:artcile_custom
Cheers
Last edited by Dragondz (2010-05-30 09:09:01)
Offline
Re: Outputing a list of articles for specific category on landing page
Thx well spotted, that was just a typo in forum (i have had to simply code so that my question is clearer). Although my question seems to still be unclear. Perhaps this makes it clearer?
You can see these pages as landing-pages or portal-pages which with every click deeper show more specific pages ( as in Main-cat=“Car” > Sub-cat=“ford” > Sub-sub-cat=“fiesta” > Sub-sub-sub-cat=fiesta2010 model” )
1. I dont want a list of cat titles. I want a list of main-cat articles.
2. When an main-category article link is clicked this needs to link to sub-category landingpage and output a list of articles belonging to sub-category
3. When one of the sub-category links is clicked this in needs to link to sub-category landingpage and output a list of sub-sub-category articles… and so on and so on deeper and deeper
An hierarchical stepup each time going a layer deeper and showing all relevant articles belong to the specific child category
Last edited by Timid&friendly (2010-05-30 12:50:42)
I think, therefore I AM, … … er … I think :-?
Offline
#4 2010-05-30 13:33:26
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Outputing a list of articles for specific category on landing page
I don’t quite understand how you are using the custom field. Didn’t you create the parent-children structure in your categories?
Offline
Re: Outputing a list of articles for specific category on landing page
Yes i did create parent>child>subchild etc structure.
You can probably ignore that aspect. That’s an extra option i am playing with in this development stage. To clarify you could of course use a catergory name if it’s technically feasible. Lower down the chain i need get article(product)specifics from custom fields that can’t be covered with category names.
I guess my first question is:-
1. can you output a list of articles of a specific category on the section landingpage?
2. can you use each of these articles(with this parent category) to link to a specfic sub(child)-category and output all articles belonging to that sub(child)-category? (but excluding the (main/parent category and all nested children categories).
3. can this structure be reiterated to allow one to go deeper and deeper into the site?
Last edited by Timid&friendly (2010-05-30 16:56:07)
I think, therefore I AM, … … er … I think :-?
Offline
Re: Outputing a list of articles for specific category on landing page
I guess i’m a bigger txpnood than i thought, though i have managed to figure out how to output a list of Catergory articles on landing page. For those who also struggle with this:-
For most of my section (main-nav) i used the txp:section_list active_class="current" sections="my-section" />
. But for the Section that holds all the categories, i had to make up a category with the same name as the section and replaced the section txp tag with <txp:category_list active_class="current" section="assortiment" categories="assortiment" break="" />
This starts the chain i needed to output category article lists.
There may be a better way but this works.
I think, therefore I AM, … … er … I think :-?
Offline
#7 2010-06-01 18:44:53
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Outputing a list of articles for specific category on landing page
Sorry, I hadn’t noticed you updated your previous post. Does this mean all three of your questions are answered now?
Offline
Re: Outputing a list of articles for specific category on landing page
I haven’t solved point 2 and 3. But had no time as yet.
I think, therefore I AM, … … er … I think :-?
Offline
#9 2010-06-01 20:21:44
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Outputing a list of articles for specific category on landing page
Still not quite sure what you want. Something like this?
- (Section) page /assortiment/:
- article 1 in category Assortiment, linking to child category Export
- article 2 in category Assortiment, linking to child category Partner
- article 3 in category Assortiment, linking to child category Unique
- etcetera
- Page /assortiment/?c=export:
- article 1 in category Export, linking to child category Full-color
- article 2 in category Export, linking to child category Multi-color
- etcetera
- Page /assortiment/?c=full-color:
- article 1 in category Full-color, linking to one of its child categories (if any)
- etcetera
Offline
Re: Outputing a list of articles for specific category on landing page
Yeah that’s exactly what i am trying to do!
I think, therefore I AM, … … er … I think :-?
Offline
#11 2010-06-02 07:01:30
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Outputing a list of articles for specific category on landing page
In that case you could store the child category that an article should link to in a custom field (I think you mentioned that before).
You don’t need to change your section_list tag, if you set it up so that your ‘Assortiment’ section’s landing page only has articles in category ‘Assortiment’:
<txp:if_section name="assortiment">
<txp:if_individual_article>
<txp:article form="yoursinglearticleform" />
<txp:else />
<txp:if_category>
<!-- this is a child category page -->
<txp:article form="yourlistform" />
<txp:else />
<!-- this is the section landing page -->
<txp:article_custom section="assortiment" category="assortiment" form="yourlistform" />
</txp:if_category>
</txp:if_individual_article>
</txp:if_section>
(If section Assortiment has its own page template you can of course leave out the if_section tags.)
In form ‘yourlistform’ use something like this to link to the child category:
<txp:if_custom_field name="linktochildcat">
<txp:category name='<txp:custom_field name="linktochildcat" />' title="1" link="1" />
</txp:if_custom_field>
Offline
Re: Outputing a list of articles for specific category on landing page
Looks Great Els! THX! I will try this out a.s.a.p.
I think, therefore I AM, … … er … I think :-?
Offline