Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Are Raw PHP Tags Deprecated, Disabled or Both?
Using a copy of the latest svn along with some code from a theme from a cms who shall remain nameless, I get:
Tag error: -> Textpattern Warning: Raw PHP tags are deprecated on line 1236
Tag error: -> Textpattern Warning: raw_php_disabled on line 1241
My thinking: The first message refers to a change made in 4.0.4 in 2006. It served a purpose, but it might be time to retire it. The second message is what I would expect to see from a base install.
Offline
Re: Are Raw PHP Tags Deprecated, Disabled or Both?
I would say both. Raw PHP is deprecated, but there is still an option for enabling raw PHP in TXP’s Preferences (Allow raw PHP under Advanced Prefefences). By default raw PHP option is set to disabled.
michaelkpate wrote:
It served a purpose, but it might be time to retire it.
Which would remove both messages, as the option would be gone too.
Last edited by Gocom (2011-05-31 17:22:40)
Offline
Re: Are Raw PHP Tags Deprecated, Disabled or Both?
Perhaps I am looking at it wrong:
Tag error: -> Textpattern Warning: Raw PHP tags are deprecated on line 1236
This is for someone who is doing an upgrade from 4.0.3 and used raw PHP as part of their code. The message tells them that they should do things a different way now.
Tag error: -> Textpattern Warning: raw_php_disabled on line 1241
This is for someone who is creating a new site and includes purposefully but didn’t remember to turn the option on. The message tells them that they can use raw PHP but only if they take the time to turn it on in preferences.
It probably doesn’t matter really, but for a new user to get a message that something was deprecated years ago, just doesn’t seem particularly relevant. But on the other hand, it does sort of initiate them into the history of changes.
Offline
Re: Are Raw PHP Tags Deprecated, Disabled or Both?
michaelkpate wrote:
It probably doesn’t matter really, but for a new user to get a message that something was deprecated years ago, just doesn’t seem particularly relevant. But on the other hand, it does sort of initiate them into the history of changes.
Deprecated notices announce that the feature is dropped and will be removed sometime in the future. The message will be gone when the support for raw PHP is removed.
Last edited by Gocom (2011-05-31 19:56:50)
Offline
Re: Are Raw PHP Tags Deprecated, Disabled or Both?
In the future, what should one do instead of using the raw php tags?
I use them all the time for inserting content created by non Txp modules. I wrap <txp:php> </txp:php> around php code, perl code – and even simple html content. It works beautifully. It is damn handy for inserting weather data and all sorts of dynamic content.
If it is going away – 2 questions.
1. Why
2. What is a suitable alternative for a Textpattern user?
Offline
Re: Are Raw PHP Tags Deprecated, Disabled or Both?
This is NOT going away:
<txp:php> php code </txp:php>
This is what this topic is about:
<?php code ?>
Offline
Re: Are Raw PHP Tags Deprecated, Disabled or Both?
My misunderstanding. Thank you.
I remain confused on this issue, however. If I turn off “Allow raw PHP?” under Admin > Preferences > Advanced, the code on my sites using <txp:php> php code </txp:php> stops working. I use no instances of <?php code ?>.
I have “Allow PHP in pages?” and “Allow PHP in articles?” checked yes.
The <txp:php> php code </txp:php> tags I use are placed in forms. They look like this:
<txp:php>include(‘path/to/script.php’)</txp:php>
If I turn on “Allow raw PHP?” – everything works fine.Last edited by towndock (2011-08-21 18:48:09)
Offline
Re: Are Raw PHP Tags Deprecated, Disabled or Both?
I was working with a WordPress theme and as they tend to do, it had a lot of php code encased in <?php code ?>.
In versions of Textpattern prior to 4.0.4 (“Deprecate old-style PHP tags”) and the introduction <txp:php> you could use the standard method and didn’t get an error message. I had a site logon feature that worked that way at the time. Personally, I never turn on the raw option these days and pretty much avoid using php at all if I can help it – which isn’t always possible.
Offline
Re: Are Raw PHP Tags Deprecated, Disabled or Both?
Allow raw PHP? preference doesn’t effect <txp:php>
tags. But it effects whether the pages as whole are evaluated or not. If allow_raw_php_scripting
is set to true, whole page is run with eval using the trick also mentioned in the eval’s documentation’s user comments.
If you were to show us the complete code of yours (meaning all of it, including the problem page’s tag soup and the included scripts) then we might be able to tell what causes the issue.
Offline