Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
section landing page
Hi,
How can I make a section’s default landing page contain one specific article and not a list of all the articles in that section?
For instance I would like this page
http://nwtc.ie/index.php?c=training
to be like this one.
http://nwtc.ie/index.php?id=7
The second link uses the same page template but i dont see how to format the default landing page for a section
please advise
Last edited by kvnmcwebn (2007-05-12 15:50:10)
its a bad hen that wont scratch itself.
photogallery
Offline
Offline
Re: section landing page
Or you can use a section-specific ‘sticky’ article.
Offline
Re: section landing page
If you just want only the last article to show use <txp:article limit="1" ... />
, which will show only one article. If you want to always show the same article with a specific ID, use <txp:article_custom id="(article-id-number)" ... />
. Put that inside an txp:if_category
tag like variaas suggests, e.g.:
<txp:if_category name="training">
<txp:article_custom id="7" form="myform" />
<txp:else />
...
</txp:if_category>
etc.
TXP Builders – finely-crafted code, design and txp
Offline
Re: section landing page
thanks this is brilliant, can you just bare with me for a minute.
I will create a custom article for the landing page and give it a custom article id right.
But whats form for?
<txp:if_category name=“training”>
<txp:article_custom id=“7” form=“myform” />
<txp:else />
<txp:article allowoverride=“0” pgonly=“0” searchall=“1” searchsticky=“0” sort=“Category1 asc” status=“4” />
</txp:if_category>
Neil I will have to look up the “sticky” article, does that mean the article persists in the article listing order?
its a bad hen that wont scratch itself.
photogallery
Offline
Re: section landing page
form is the name of the article form you use to display your articles. If you don’t specify it, the standard form “default” will be used (you can look it up in the forms tab).
You don’t need to create a custom article or id, just note the ID number of the article you want to show up on the training category page and use it in place of “7” in the example above (the ‘custom’ refers only to the function which offers more customised article output compared to the standard txp:article, both use the normal articles).
TXP Builders – finely-crafted code, design and txp
Offline
Re: section landing page
wow this is really helpful
its a bad hen that wont scratch itself.
photogallery
Offline
Re: section landing page
Ok got this working, i had to change the if_category to an if_section.
<txp:if_section name=“training”>
<txp:article_custom id=“10” form=“default” />
<txp:else />
<txp:article form=“default” limit=“1” />
</txp:if_section>
It works fine. but what should i put in for the <else>? i cant seem to get any of the other articles to work with the above code. it returns this errorNotice: missing_article_tag: training in /home/nwtc/www/textpattern/publish.php on line 462
heres the link
http://nwtc.ie/index.php?s=training
Last edited by kvnmcwebn (2007-05-13 12:49:08)
its a bad hen that wont scratch itself.
photogallery
Offline
#9 2007-05-14 00:27:31
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: section landing page
Try the following (comments added so you can see what each does):
<!-- if we are on the "training" section... -->
<txp:if_section name="training">
<!-- if we are viewing an individual article... -->
<txp:if_individual_article>
<!-- ...display it -->
<txp:article limit="1" />
<!-- otherwise... -->
<txp:else />
<!-- ...display a specific article -->
<txp:article_custom id="10" />
</txp:if_individual_article>
<!-- otherwise... -->
<txp:else />
<!-- ...show 1 article at a time -->
<txp:article limit="1" />
</txp:if_section>
You will still get that notice, but you can safely ignore it. Changing your “Production mode” in your Preferences to “Live” will hide it from view.
Offline
Re: section landing page
Mary this is magic, it works beautifully.
You’ve saved me from hacking this site together…i was just about to get out the duct tape.
It never would have occurred to me to nest conditional comments.
thanksX10
its a bad hen that wont scratch itself.
photogallery
Offline
Pages: 1