Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Is this possible ... and how?
On this site (under construction) we have a section called ‘medewerkers’ (employees). Every article in this section is a ‘medewerker’ and has a category (‘staf’ or ‘administratie’ or ‘assessoren’) assigned to it.
On the landing page the first articles to be displayed must be of the category ‘staf’. In the right column there has to be a list of (the) categories. Clickable so that the articles with that particular category will be rendered in the maincolumn of the (landing?) page. And it would be great if the active category in the list can be highlighted!
Well, I know … I’m asking a lot but I’m totally stuck. Help is much appreciated. Thanks in advance.
Offline
Re: Is this possible ... and how?
You can use article_custom to output olnly “Staff” articles like:
<txp:article_custom section="medewerkers" category="staff" limit="1" sort="your-sort" form="your-article-form" />
following by other article tag like:
<txp:artilce />
For highlight active category you can use:
<txp:category_list break="li" wraptag="ul" active_class="you-active-class" />
Keep in touch
Last edited by wornout (2010-08-04 15:15:50)
Offline
Re: Is this possible ... and how?
use <txp:category_list>
and for show in main column the article from categories use <txp:if_category> <txp:article/> </txp:if_category>
<txp:txp_me />
Offline
#4 2010-10-06 17:43:25
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Is this possible ... and how?
Hi Joop, do you need individual article pages as well in this section? And I assume you want to highlight category ‘Staf’ when on the section landing page?
Offline
Re: Is this possible ... and how?
Els wrote:
Hi Joop, do you need individual article pages as well in this section? And I assume you want to highlight category ‘Staf’ when on the section landing page?
If I understand what you’re asking the answer on the first question is ‘no’ … and the second is ‘yes’!
The landing page has all the articles (medewerkers) of the category ‘Staf’ … and yes, ‘Staf’ highlighted in the sidebar. And when you click (sidebar!) on lets say ‘Assessoren’, then all articles (medewerkers) are displayed and the category title in the sidebar is highlighted.
Thanks for helping me!
Offline
#6 2010-10-06 20:06:58
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Is this possible ... and how?
Well, I hope I didn’t forget to close a tag or something stupid like that.
Main content:
<txp:if_section name="medewerkers">
<txp:if_article_list>
<txp:if_category name="staf,administratie,assessoren">
<!-- one of the category pages -->
<txp:article form="yourform" limit="..." />
<txp:else />
<!-- section landing page -->
<txp:article_custom section='<txp:section />' category="staf" form="yourform" limit="..." />
</txp:if_category>
</txp:if_article_list>
</txp:if_section>
Navigation: I’m glad you chose to display ‘Staf’ as the first category, it saves code ;) I indented the code so it’s easier to follow, remove the whitespace and the comments if you are going to use it ;)
<txp:if_section name="medewerkers">
<txp:category_list categories="staf,administratie,assessoren" wraptag="ul" break="">
<txp:if_first_category>
<li<txp:if_category name='<txp:category />'> class="active"<txp:else /><txp:if_category><txp:else /><txp:if_article_list> class="active"</txp:if_article_list></txp:if_category></txp:if_category>><txp:category title="1" link="1" this_section="1" /></li>
<txp:else />
<li<txp:if_category name='<txp:category />'> class="active"</txp:if_category>><txp:category title="1" link="1" this_section="1" /></li>
</txp:if_first_category>
</txp:category_list>
</txp:if_section>
Last edited by els (2010-10-06 20:27:06)
Offline
Re: Is this possible ... and how?
Oops > ../index.php?s=medewerkers
To be continued … tomorrow I think!
Offline
#8 2010-10-06 20:19:08
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Is this possible ... and how?
Damn. No I can’t leave this till tomorrow ;)
Offline
#9 2010-10-06 20:25:23
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Is this possible ... and how?
So much for nice indentation ;) I edited the code above, can you try again?
Offline
Re: Is this possible ... and how?
Well … I’m going to bed now! Good night, and good luck … :)
Eh … I’ve put the latest piece of code (without ‘the nice indentation’) into the page btw!
Last edited by RedFox (2010-10-06 20:36:02)
Offline
#11 2010-10-06 20:47:24
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Is this possible ... and how?
Good morning Joop ;) (or are you still here?)
It works doesn’t it?
For the main content code, I think you left something in there:
Tag foutmelding <txp:article form="yourform" limit="..." /> -> Warning: Division by zero on line 739
You left it in the article_custom tag as well.
Last edited by els (2010-10-06 20:59:39)
Offline
Re: Is this possible ... and how?
Good (early!) morning Els … :)
<txp:if_section name="medewerkers">
<txp:if_article_list>
<txp:if_category name="staf,administratie,assessoren">
<!-- one of the category pages -->
<txp:article form="singlenolinknodate" limit="" />
<txp:else />
<!-- section landing page -->
<txp:article_custom section='<txp:section />' category="staf" form="singlenolinknodate" limit="" />
</txp:if_category>
</txp:if_article_list>
</txp:if_section>
I’m sorry, but it doesn’t work … :(
Last edited by RedFox (2010-10-07 03:04:34)
Offline