Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
if_different for automated by-section sitemap
For a non-blog website I’m using if_different for an automated by-section sitemap. In the page template I use the following:
<code><dl><txp:article_custom limit=“99999” form=“sitemap” sortby=“section” sortdir=“asc” /></dl></code>
.
to call the form “sitemap” as follows:
<code>
<txp:if_different>
<dt><txp:section title=“1” /></dt>
</txp:if_different>
</code>
<code>
<dd><txp:permlink><txp:title /></txp:permlink></dd>
</code>
.
so far so good and quick and easy (the FAQ article by zem was a big help, although there are some errors in the closing tags there – thanks zem):
But: How can I restrict the output to exclude certain sections?
I want to list out all the general areas of the website but for a better overview leave out particular sections with many articles such as the numerous news articles (most of which quickly become obsolete) or member datasets.
I saw elsewhere that doggiez suggested that you can call article_custom with categories=“cat1,cat2,cat3” but article_custom doesn’t like “section=“about,products,contact,services” etc. and produces no output at all.
Any ideas? Thanks for any pointers…
jakob
TXP Builders – finely-crafted code, design and txp
Offline
#2 2006-02-28 22:04:46
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: if_different for automated by-section sitemap
I’m not sure about this, but would this code in your form ‘sitemap’ work?
<code>
<txp:if_article_section name=“about,products,contact”>
the rest of your code
</txp:if_article_section>
</code>
Offline
Re: if_different for automated by-section sitemap
@ jakob
Look at the manual: txp:article_custom accepts the “section” attribute.
@ doggiez, “txp:if_article_section” isnt currently (4.0.3) supporting multiple values separated by comma.
I requested the feature before 4.0.3 release and rsilletti post a solution (modifying taghandlers.php), but it hasnt been included with the release.
I think that feature is a must-have… it makes sense with the logic of TXP and the txp:if_section tag.
Offline
#4 2006-02-28 23:08:15
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: if_different for automated by-section sitemap
Duh, thanks maniqui, of course I knew that… just didn’t think.
But if you don’t need to show too many sections, I think you could repeat the code for each section as a workaround.
Does article_custom accept multiple sections? I think chh_article_custom does.
Offline
Re: if_different for automated by-section sitemap
> doggiez wrote:
> Does article_custom accept multiple sections? I think chh_article_custom does.
Ops! I think you are right and txp:article_custom doesnt accept multiple sections. My mistake, sorry.
Offline
Re: if_different for automated by-section sitemap
Look at the manual: txp:article_custom accepts the “section” attribute.
yes, but only one – you saw that yourself.
But if you don’t need to show too many sections, I think you could repeat the code for each section as a workaround.
This is what I have done for the moment. Then hand written the dl-dt-dd combinations pointing to the separate list pages for the excluded sections.
It’s okay but not self-extensible should new sections be added (Note to self: remember to document this for possible later site updates).
The good news: chh_article_custom does work with multiple sections (couldn’t see if not-sections were possible). Note that you have build the tag using listform=“sitemap” instead of form=“sitemap”:
<code><txp:chh_article_custom limit=“99999” listform=“sitemap” sortby=“section” sortdir=“asc” section=“about,products,contact,services” /></code>
It’s also a big help if you also install chh_article_lib too (doh!).
Thanks maniqui and doggiez, and thanks takshaka too!
TXP Builders – finely-crafted code, design and txp
Offline