Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2019-08-14 15:05:31

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: txp PHP does not output

That was the easiest thing to do, I have not found a way to tell articles content from forms output after the first pass :-/

Offline

#14 2019-08-15 03:13:03

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: txp PHP does not output

Thank you for all the assistance and input.

Good to know that <txp:php /> being disabled on the second pass has made txp safer. And the new <txp:evaluate /> is awesome!


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#15 2019-10-09 16:55:44

towndock
Member
From: Oriental, NC USA
Registered: 2007-04-06
Posts: 329
Website

Re: txp PHP does not output

etc wrote #319052:

Another point: if your code requires more complex calculations, you can register “safe” php functions for use in <txp:evaluate /> via advanced prefs.

Could you explain how to register php functions in advanced prefs? (I can’t find this in the docs)

I do indeed have a site with complex calculations. I’m unable to determine a way that doesn’t involve a second pass to display some of our content.

Last edited by towndock (2019-10-09 16:56:08)

Offline

#16 2019-10-09 18:26:03

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: txp PHP does not output

towndock wrote #319604:

Could you explain how to register php functions in advanced prefs? (I can’t find this in the docs)

I do indeed have a site with complex calculations. I’m unable to determine a way that doesn’t involve a second pass to display some of our content.

Sure, though this will only help with simple one-line calculations. Go to Preferences/Admin pane, switch Advanced options on and save. You will then gain access to Advanced options pane, where you will find PHP functions enabled in txp:evaluate pref. Its help is rather terse, so don’t hesitate to post your calculations here if needed.

Offline

#17 2019-10-10 21:14:02

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: txp PHP does not output

Now <txp:php /> should work (almost) as before in dev branch, testers welcome. Article context is preserved on second+ passes, so users without php rights should not be able to bypass this restriction any more.

An extra bonus is that (mistyped) things like

<txp:article_custom id="1,2,3" break=",">
    <txp:variable name="id" value="<txp:article_id />" />
    <txp:variable name="id" />
</txp:article_custom>

now work as expected, outputting 1,2,3. You can try it in 4.7- to see the difference.

Offline

#18 2019-10-14 16:37:47

towndock
Member
From: Oriental, NC USA
Registered: 2007-04-06
Posts: 329
Website

Re: txp PHP does not output

etc wrote #319641:

Now <txp:php /> should work (almost) as before in dev branch, testers welcome. Article context is preserved on second+ passes, so users without php rights should not be able to bypass this restriction any more.

Now testing the 4.80 dev branch – all working fine with content that requires that second pass. Thank you much. Will be testing this version further.

Offline

#19 2019-10-14 19:51:02

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: txp PHP does not output

towndock wrote #319710:

Now testing the 4.80 dev branch – all working fine with content that requires that second pass.

Nice to know it, thanks for testing. Sorry for the trouble it could have caused, but we patch all potential security holes asap, sometimes brutally.

Offline

Board footer

Powered by FluxBB