Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2016-06-01 12:18:51
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 276
How to escape current article from article custom list
on the Forms —> default i’ve these codes:
<txp:variable name="current"><txp:category2 /></txp:variable>
<txp:article_custom category='<txp:variable name="current" />'>
<p><txp:title /></p>
</txp:article_custom>
How i can escape the current article title from that list ?
Offline
Re: How to escape current article from article custom list
I think this is what you are going for.
<txp:variable name="current"><txp:category2 /></txp:variable>
<txp:variable name="currentid"><txp:article_id /></txp:variable>
<txp:article_custom category='<txp:variable name="current" />'>
<txp:if_variable name="currentid" value='<txp:article_id />'>
<txp:else />
<p><txp:title /></p>
</txp:if_variable>
</txp:article_custom>
Offline
Re: How to escape current article from article custom list
or you could do it withou the use of variables
<txp:article_custom category='<txp:category2 />'>
<txp:if_article_id id='<txp:article_id" />'>
<txp:else />
<p><txp:title /></p>
</txp:if_article_id>
</txp:article_custom>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: How to escape current article from article custom list
colak wrote #299392:
or you could do it without the use of variables
Unfortunately, you can’t. Inside article_custom the value of article_id changes right along with title. Add some error-checking code to your code:
<txp:article_custom category='<txp:category2 />'>
<txp:if_article_id id='<txp:article_id />'>
<txp:article_id />
<txp:else />
<p><txp:title /></p>
</txp:if_article_id>
</txp:article_custom>
and depending on which article you start from you get something like:
10 9 8 7 6 5 4 2 3 1
Offline
Re: How to escape current article from article custom list
michaelkpate wrote #299397:
Unfortunately, you can’t. Inside article_custom the value of article_id changes right along with title.
Hi Michael,
Well spotted re extra "
.
When someone is In an individual article, I think that it works. The side menu I have here uses the code below which is not that different from my suggestion above.
<txp:article_custom label='Other <txp:section />' labeltag="h4" section='<txp:section />' limit="600" wraptag="ul" break="li" class="submenu">
<txp:if_article_id>
<span><txp:title /></span>
<txp:else />
<a href="<txp:permlink />" rel="bookmark"><txp:title /></a>
</txp:if_article_id>
</txp:article_custom>
when I remove <span><txp:title /></span>
, the current article disappears from the list
> Edited to add… Hmmm it is slightly different…
maybe the code could be even simpler:
<txp:article_custom category='<txp:category2 />'>
<txp:if_article_id>
<txp:else />
<p><txp:title /></p>
</txp:if_article_id>
</txp:article_custom>
Last edited by colak (2016-06-02 05:10:15)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: How to escape current article from article custom list
That will be easier in 4.6:
<txp:related_articles match="Category2" break="p">
<txp:title />
</txp:related_articles>
Offline
Re: How to escape current article from article custom list
Also possible in 4.6:
<txp:article_custom category='<txp:category2 />' exclude='<txp:article_id />'>
<p><txp:title /></p>
</txp:article_custom>
Offline
#8 2016-06-05 05:57:08
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 276
Re: How to escape current article from article custom list
Thank you, The first option works fine for me :-)
Offline