Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
<txp:php> in article/title
I’m trying to get the current month (in PHP form it would be <?php echo date('F Y'); />
) to be displayed in either the title or article body. Using the Textbook examples of:
<txp:php> phpinfo();
</txp:php>
and
<txp:php> echo “The current TXP category is: “ . category(array( ‘title’ => ‘1’, ‘link’ => ‘1’, ‘wraptag’ => ‘div’ ));
</txp:php>
within the article body gives me a parsing syntax error: syntax error, unexpected '<' in /var/www/sitepath/textpattern/publish/taghandlers.php(3089) : eval()'d code on line 2
& Parse error: syntax error, unexpected '&' in /var/www/sitepath/textpattern/publish/taghandlers.php(3089) : eval()'d code on line 2
respectively, but nothing else to go on. Are there restrictions on the placing of where <txp:php>
can be used, or am I missing something obvious (hopefully the latter…)?
Thanks in advance :)
Edit: added second error.
Last edited by gaekwad (2009-05-14 10:11:42)
Offline
Re: <txp:php> in article/title
Try
<txp:php>echo date('F Y'); </txp:php>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: <txp:php> in article/title
colak wrote:
Try
<txp:php>echo date('F Y'); </txp:php>
Hi, colak. Thank you for your suggestion – unfortunately, I get a similar error: Parse error: syntax error, unexpected $end, expecting T_STRING or T_VARIABLE or '$' in /var/www/sitepath/textpattern/publish/taghandlers.php(3089) : eval()'d code on line 1
when I try this in an article context.
TXP 4.0.8 (r3085) with PHP 5.2.6-3ubuntu4.1, for info. All diagnostics pass, except for DNS (I’m localhosting).
Edit: <txp:php>echo date('F Y'); </txp:php>
does work outside of the article body context, say in a sidebar, for example. So maybe it’s not happy in an article context after all…
Thanks again, colak.
Last edited by gaekwad (2009-05-14 10:32:31)
Offline
Re: <txp:php> in article/title
You’d probably have to escape Textile:
==<txp:php>echo date('F Y'); </txp:php>==
Offline
Re: <txp:php> in article/title
wet wrote:
You’d probably have to escape Textile:
<txp:php>echo date('F Y'); </txp:php>
And that’s it :) i was missing something obvious. Thank you, wet – greatly appreciated.
Last edited by gaekwad (2009-05-14 10:41:15)
Offline
Re: <txp:php> in article/title
As an extension to my original query, is it possible to have <txp:php>echo date('F Y'); </txp:php>
in the article title, or is that parsed in a different way? Both raw code and escaped Textile-proof instances just spit out the characters rather than the date.
Sorry for being a pain/pedant about this – I looked around and couldn’t see it covered already.
Thanks again :)
Offline
Re: <txp:php> in article/title
<txp:title>
does no parsing.
Offline
Re: <txp:php> in article/title
wet wrote:
<txp:title>
does no parsing.
Thanks again, wet – appreciate it :)
Offline
Pages: 1