Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2016-03-02 15:59:27

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 401

Putting <txp:body> into a PHP variable

Hi there
I am going to change the approach of my problem that I posted here

What I need is to put the <txp:body> into a PHP variable (not TXP variable) in order to use a function that I really need.
My try was this but evidently it doesn’t work:

<txp:php>
$body = '<txp:body/>';
echo stripslashes( html_entity_decode($body, ENT_QUOTES, 'UTF-8') );
</txp:php>

How would you put the content of <txp:body/> or <txp:excerpt/> into a PHP variable or this PHP function?
Thanks in advanced

Last edited by gfdesign (2016-03-02 16:50:45)

Offline

#2 2016-03-02 16:16:24

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Putting <txp:body> into a PHP variable

You’re almost there:

$body = parse('<txp:body/>');

Offline

#3 2016-03-02 16:28:46

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 401

Re: Putting <txp:body> into a PHP variable

Perfect! That works!
You just made my day. :D
Many thanks.

Offline

Board footer

Powered by FluxBB