Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#13 2005-10-19 19:42:52
- R.M.S.
- Member
- Registered: 2005-09-12
- Posts: 15
Re: tags -in- tags
> Sencer wrote: “The shortest is to use PHP in your templates, the “cleaner” way is to write a plugin for that purpose.
Of course you have to know php so this is not a solution for your average user.”
It is not a solution for the average user, but you shouldn’t underestimate the fraction of TxP-users that are developers. :) Myself, I’m a novice when it comes to programming having never had any formal education in the field, and just searching php.net for every function I require. Although sometimes things do get messy, TxP is overall very clean code. My compliments and thanks again.
Last edited by R.M.S. (2005-10-19 19:47:01)
Offline
Re: tags -in- tags
<blockquote>Chh_article_custom would require to pass the current section as a tag-in-tag just like txp:article_custom does, which is impossible as this past discussion proved.</blockquote>
I undestand that <a href=“http://forum.textpattern.com/viewtopic.php?id=2306”>chh_article_custom</a> is context-sensitive (is that the same as section-sensitive?). It defaults to current section.
It’s more similar to txp:article and not to txp:article_custom, but the name maybe is confusing.
<blockquote>If only txp:article_custom had the possibility to pass section=”%current”</blockquote>
I would like that too. Is there any technical reason for article_custom not be section-sensitive?
Offline
Re: tags -in- tags
> R.M.S. wrote:
It is not a solution for the average user, but you shouldn’t underestimate the fraction of TxP-users that are developers. :)
You shouldn’t underestimate how many users became developers because of txp ;-)
Offline
Re: tags -in- tags
> maniqui wrote:
I undestand that <a href=“http://forum.textpattern.com/viewtopic.php?id=2306”>chh_article_custom</a> is context-sensitive (is that the same as section-sensitive?). It defaults to current section.
O o, I suppose your right. It really might suit my needs, I will give it a try. Thanks for the pointer!
Offline
Re: tags -in- tags
> wet wrote:
If only txp:article_custom had the possibility to passsection="%current"
or the like,%current
being defined as a special purpose keyword…
One option could be to create a <txp: variable> tag which could be used to pass variables to tags. This is how XSLT does it so it is pro-xml. Basically something like this
<txp:variable name="current-section"><txp:section /></txp:variable>
You could then call that by doing <txp:article_cutom section="{$current-section}" />
Anyway that’s how XSLT does it. I have no idea how this could be implemented as I would think it would also require changing the parser. It would allow for turning the result of any tag into a variable which could be very powerful.
Shoving is the answer – pusher robot
Offline
Re: tags -in- tags
Who will volunteer to write the eclipse plugin and the debugger for “txp – the meta script language”?
Offline
Re: tags -in- tags
> Sencer wrote:
The shortest is to use PHP in your templates, the “cleaner” way is to write a plugin for that purpose.
Example:
<code>
<txp:php>echo article_custom(array(“form”=>“default”, “section”=> section(array())));</txp:php>
</code>
Is it true that this will work in page templates but won’t work in articles? At least in my case it delivers an error message stating:
Parse error: parse error, unexpected ‘=’, expecting ‘)’ in /www/xxxx/textpattern/publish/taghandlers.php(1605) : eval()’d code on line 1
I’ve checked nesting but could spot an error. Is there a way besides coding a plugin to embed this into an article?
//w&
Offline
Re: tags -in- tags
IIRC you can’t use article or article_custom tags in articles either (leaving aside the potential problem of infinit loops if it was possible).
Offline
Re: tags -in- tags
Thanks, Sencer.
I’ve finally succeeded by putting your code embraced by some enclosing conditionals into a form (to reduce clutter) and use txp:output_form
in my section agnostic page template. Works as intended, great.
Last edited by wet (2005-10-20 08:27:56)
Offline
Re: tags -in- tags
> maniqui wrote:
wet:
can you create a forum thread to discuss your djw_section_articles plug-in ? I cant make it work.
Done.
Offline
Re: tags -in- tags
I’d also like to use php to circumvent using a tag within a tag to display a custom article for my photo gallery, but since I definitely lean more towards the “user becoming developer because of txp” crowd, I need some help to form the statement.
Please take a look at this post if you can help. Thanks!
Offline