Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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

#14 2005-10-19 19:45:02

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#15 2005-10-19 19:45:49

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

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

#16 2005-10-19 19:51:19

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

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

#17 2005-10-19 20:18:08

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: tags -in- tags

> wet wrote:
If only txp:article_custom had the possibility to pass section="%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

#18 2005-10-19 20:24:57

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: tags -in- tags

Who will volunteer to write the eclipse plugin and the debugger for “txp – the meta script language”?

Offline

#19 2005-10-20 06:12:29

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

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

#20 2005-10-20 08:01:42

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

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

#21 2005-10-20 08:27:24

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

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

#22 2005-11-03 14:22:50

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

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

#23 2006-01-01 18:16:12

matt7530
Member
Registered: 2004-11-01
Posts: 23
Website

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

Board footer

Powered by FluxBB