Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#13 2008-11-22 20:56:12
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Linking to a specific article
Bexxie wrote:
(i’m not sure how you clean up the code to display better):
How do I post tags and code on the forum? :)
Also, would you be able explain to me what the code that you gave me in the form and the template are essentially doing? I’m trying to understand the logic of how txp works. Thanks so much for your help!
Txp has lots of conditional tags that allow you to make ‘exceptions’ to the default behaviour.
For instance the entire content of an article form will be repeated for every article that is called by the article or article_custom tag. Of course you only need the <div id="music"><ul>
once, at the beginning of the list, and the closing tags only at the end of the list. So if_first_article and if_last_article can be used to take care of that.
The other conditional used is if_article_list. Something that may not be so clear when you start using Txp is that <txp:article_custom />
can only display article lists. That’s why you got the notice that there was no article tag. So here we’re telling Txp to use the article_custom tag when an article list is displayed, and if not (= when an individual article is displayed), use the article tag. (There is a little bit more to it than that, but this will work for you. You can read more about article vs. article_custom here.)
There is also if_individual_article, which does exactly the opposite of if_article_list. This would do exactly the same as the code I suggested:
<txp:if_individual_article>
<txp:article form="your_individual_article_form" />
<txp:else />
<txp:article_custom form="music" section="music" />
</txp:if_individual_article>
Offline
#14 2008-11-29 02:26:29
- Bexxie
- Member
- From: NJ, U.S.A.
- Registered: 2008-10-05
- Posts: 14
Re: Linking to a specific article
Thanks for the explanation! The more I learn how to use Txp, the more I love it :)
Offline