Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2007-07-13 11:33:22
- beechy
- Member
- Registered: 2006-03-02
- Posts: 92
Php in articles
How would I put the following php into a article?
<li <? echo addErrors(‘field0’, $fieldErrors, ‘class’) ?>>
At the moment the following produces an error
<li <txp:php> echo addErrors(‘field0’, $fieldErrors, ‘class’) </txp:php>>
Offline
Re: Php in articles
Which error?
Offline
#3 2007-07-13 11:38:47
- beechy
- Member
- Registered: 2006-03-02
- Posts: 92
Re: Php in articles
Parse error: parse error, unexpected $, expecting ‘,’ or ‘;’ in textpattern/publish/taghandlers.php(2688) : eval()’d code on line 1 >
Offline
#4 2007-07-13 11:45:32
- beechy
- Member
- Registered: 2006-03-02
- Posts: 92
Re: Php in articles
if I turn on raw php in articles and enter the raw php the script works however I get the following error message above the <head></head> which puts all my formatting out of wack…
Warning: Raw PHP tags are deprecated in textpattern/publish.php on line 996
this happens even when I set the mode from testing to live
Last edited by beechy (2007-07-13 11:53:24)
Offline
Re: Php in articles
Try: <li <txp:php> echo addErrors('field0', $fieldErrors, 'class'); </txp:php>>
Note the semicolon after the closing )
But, I don’t think this will work unless you somehow also define $fieldErrors in that piece of PHP or reference it as a global variable, otherwise $fieldErrors will be undefined.
Last edited by ruud (2007-07-13 12:10:21)
Offline
#6 2007-07-13 13:07:30
- beechy
- Member
- Registered: 2006-03-02
- Posts: 92
Re: Php in articles
ruud thanks for that but I had already tried this.
I think the problem is to do with Escaping to XHTML as explained here http://textpattern.com/faq/34/how-do-i-use-php-code
If I allow raw php in my content articles the script work fine. However I get the error message Warning: Raw PHP tags are deprecated in textpattern/publish.php on line 996 because I am in debugging mode if I change to live I still get this error message. How can I get rid of this error message.
Offline
#7 2007-07-13 14:01:03
- beechy
- Member
- Registered: 2006-03-02
- Posts: 92
Re: Php in articles
I fixed the live error issue with this bug fix from yourself ruud http://dev.textpattern.com/changeset/1973
Offline
Pages: 1