Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Urgent help with Article tag
Hello,
I have a sidebar where articles list is generated.
When that page is opened, by default, last posted article is displayed.
But I need to show article of my choice rather than the last posted.
How to do this?
Below is my code :
<div id=“sidebar”>
<txp:if_section name=“melange”>
<txp:image id=“4” />
<txp:else />
<h2><txp:section title=“1” /></h2><br />
</txp:if_section>
<txp:article_custom section=’<txp:section />’ wraptag=“ul” break=”“ status=“sticky” sort=“id desc” limit=“99”>
<li <txp:if_article_id>class=“side-active”</txp:if_article_id>>
<txp:permlink><txp:title /></txp:permlink></li>
</txp:article_custom>
</div><!—#sidebar—>
<section class=“hfeed”>
<txp:article limit=“1” form=“static_article” status=“sticky” />
</section>
Last edited by vineonardo (2011-12-29 08:15:15)
Offline
Re: Urgent help with Article tag
I think your problem came with this line:
<txp:article_custom section='<txp:section />' wraptag="ul" break="" status="sticky" sort="id desc" limit="99">
in front page (without section in url) the txp:section is empty then the tag grab the last article in hole website not only in a particular section, you can handle that with this kind of code:
<txp:if_section name="">
<txp:article_custom section="some_sections_name_here" wraptag="ul" break="" status="sticky" sort="id desc" limit="99">
<txp:else />
<txp:article_custom section='<txp:section />' wraptag="ul" break="" status="sticky" sort="id desc" limit="99">
</txp:if_section>
you must also take care when you are in individual article using txp:if_article_list or txp:if_individual_article tag for that! see the textpattern documentation
Cheers
Last edited by Dragondz (2011-12-29 08:42:10)
Offline
Re: Urgent help with Article tag
Hey thanks for reply, but it doesnt seem to help me.
What I need is to show an article of my choice by default, not the last added one.
I tried your code and it doesnt seem to solve my problem.
below is my code, see if I am going wrong anywhere.
Section name is “about”
<div id=“sidebar”>
<txp:if_section name=”“>
<txp:article_custom section=“about” wraptag=“ul” break=”“ status=“sticky” sort=“id desc” limit=“99” />
<txp:else />
<txp:article_custom section=”<txp:section />” wraptag=“ul” break=”“ status=“sticky” sort=“id desc” limit=“99” />
</txp:if_section>
</div>
<div id=“hfeed”>
<txp:article limit=“1” form=“static_article” status=“sticky” />
</div>
</div><!— #content-inner —>
</div><!— #content —>
Offline
Re: Urgent help with Article tag
Hi
you must use simple cote when making tag in tag construction:
<txp:article_custom section='<txp:section />' wraptag="ul" break="" status="sticky" sort="id desc" limit="99" />
I dont understund what you want to do, with that code:
<txp:article_custom section="about" wraptag="ul" break="" status="sticky" sort="id desc" limit="99" />
you will show all articles posted on about section with sticky status, if you want to select a particular article you must specify an article id with this code:
<txp:article_custom id="ARTICLE_ID" wraptag="ul" break="" />
replacing ARTICLE_ID with the id of the article you want to show.
Cheers
Offline
Re: Urgent help with Article tag
Hey,
Thanks for quick reply, actually I was little confuse with your first code so I used this code
bq. <txp:article_custom section=“about” wraptag=“ul” break=”“ status=“sticky” sort=“id desc” limit=“99” />
It didnt work, as we already know.
Now I am thinking to simply use <txp:if_section > to show custom articles using your suggested
bq. <txp:article_custom id=“ARTICLE_ID” wraptag=“ul” break=”“ />
Thanks again, have a good day/night! :)
Offline
Re: Urgent help with Article tag
Hi
If you use one sticky article in each section you can avoid using a bunch of txp:if_section by using this code:
<div id="sidebar">
<txp:if_section name="">
<txp:article_custom section="about" wraptag="ul" break="" status="sticky" />
<txp:else />
<txp:article_custom section='<txp:section />' wraptag="ul" break="" status="sticky" />
</txp:if_section>
</div>
NB: note the simple quote used around txp:section
Last edited by Dragondz (2012-01-10 19:58:28)
Offline
Offline
Pages: 1