Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-04-12 15:13:56

classcreative
Member
From: Solihull
Registered: 2009-05-22
Posts: 12
Website

Get <txp:yield/> value in PHP

Hello,

How do you get the value of <txp:yield/> in PHP? I’m trying to do the following:

<txp:php>
echo “<txp:article_custom id=’” . $yield . “’><txp:permlink><txp:lam_article_image width=‘230’/></txp:permlink></txp:article_custom>”;
</txp:php>

Thanks,

Jonathan

Offline

#2 2011-04-12 15:36:38

classcreative
Member
From: Solihull
Registered: 2009-05-22
Posts: 12
Website

Re: Get <txp:yield/> value in PHP

Whoops, I needed to call the function yield() rather than the variable. This works:

<txp:php>
echo "<txp:article_custom id='" . yield() . "'><txp:permlink><txp:lam_article_image width='230'/></txp:permlink></txp:article_custom>";
</txp:php>

Offline

#3 2011-04-12 16:17:25

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

Re: Get <txp:yield/> value in PHP

You could also try:

<txp:article_custom id='<txp:yield />'><txp:permlink><txp:lam_article_image width='230'/></txp:permlink></txp:article_custom>

Check that those are single quotes, mandatory to use them when nesting using txp tag as another txp tag attribute.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2011-04-13 15:30:23

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: Get <txp:yield/> value in PHP

instead of echo you sholud use echo parse('<txp:any_tag />'); or echo any_tag(array('attr1_name'=>'attr1_value', 'attr2_name'=>'attr2_val'));

Evety txp’s tag has twin-function in php.


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

Board footer

Powered by FluxBB