Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
How can I have the article tag with message id as a variable parameter
Displaying a certain specific article is easy when the article id is known; you can do it this way:
<code> <txp:article_custom
<code> id=“14”
<code> limit=“1”
<code> listform=“prf_news_list”
<code> />
</code>
But what to do when the article id is not always the same, but is determined when someone is viewing the site.
In my case the article-id comes from a HTML-form, with the POST action. In the page that is triggered with action statement in the form I can display the article-id with the php-tag:
<code> <txp:php> echo $_GET[“article-id1”]; </txp:php></code>
This works fine.
However, this doesn’t work:
<code> <txp:article_custom
<code> id=”<txp:php> echo $_POST[“article-id1”]; </txp:php>”
<code> limit=“1”
<code> listform=“prf_news_list”
<code> />
</code>
But is there a way to make this work, or are there other solutions.
Help is very much appreciated.
Offline
#2 2006-04-30 04:55:17
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: How can I have the article tag with message id as a variable parameter
<txp:php>echo article_custom(array(
'id' => intval(gps('article-id1')),
'limit' => 1,
'form' => 'prf_news_list'
));</txp:php>
:)
Offline
Re: How can I have the article tag with message id as a variable parameter
Thanks for the repy and code. It works, just the way I want it to work. Very much appreciated!!!
Btw: is there some documentation on this issue, for it seems as if there is a possibility to call tags as a function within php..
Offline
#4 2006-05-01 03:57:35
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: How can I have the article tag with message id as a variable parameter
…is there some documentation on this issue…
Alex has composed a tutorial series on plugins, which contains info on how the tags work.
…for it seems as if there is a possibility to call tags as a function within php.
Exactly: all Textpattern tags are PHP functions. Check Alex’s tutorials and you’ll quickly see how it works. :)
Offline
Re: How can I have the article tag with message id as a variable parameter
This is great; I like this kind of architecture!!
It increased my understanding of Textpattern (and my liking of Textpattern)!!
Offline