Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2025-02-27 02:34:42

hurty
Member
Registered: 2004-07-17
Posts: 30

Bunch of errors including a bunch of errors related to 'echo date(Y)'

I’m getting this strange error on every page after moving my site from GoDaddy to Dreamhost:

Fatal error: Uncaught Error: Undefined constant "Y" in /[...]/textpattern/publish/taghandlers.php(4319) : eval()'d code:1 
Stack trace: 
#0 /[...]/textpattern/publish/taghandlers.php(4319): eval() 
#1 [internal function]: php(Array, 'echo date(Y);') 
#2 /[...]/textpattern/vendors/Textpattern/Tag/Registry.php(140): call_user_func('php', Array, 'echo date(Y);') 
#3 /[...]textpattern/lib/txplib_publish.php(559): Textpattern\Tag\Registry->process('php', Array, 'echo date(Y);') 
#4 /[...]/textpattern/lib/txplib_publish.php(409): processTags('php', '', 'echo date(Y);', true) 
#5 /[...]/textpattern/lib/txplib_misc.php(3626): parse('<!DOCTYPE html ...') 
#6 /[...]/textpattern/publish.php(740): parse_page('default', 'default') 
#7 /[...]/index.php(74): textpattern() 
#8 {main} thrown in /[...]/textpattern/publish/taghandlers.php(4319) : eval()'d code on line 1

I don’t see any errors in the diagnostic panel in the Admin interface. The Textpattern Admin interface loads correctly and I can see all the expected editing tools, etc.

This is version 4.8.8 and I have the PHP version set to 8.1

Offline

#2 2025-02-27 05:04:09

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,350
Website

Re: Bunch of errors including a bunch of errors related to 'echo date(Y)'

Assuming you have “Allow PHP in pages” (or article) enabled, then this works:

<txp:php>echo(date('Y') );</txp:php>

Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#3 2025-02-27 13:17:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,670
Website GitHub

Re: Bunch of errors including a bunch of errors related to 'echo date(Y)'

Yes, you need to quote the attribute values.

Just as an aside, when Txp 4.9.0 ships, you won’t need the PHP block as you can use this instead:

<txp:date time="now" format="%Y" />

The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2025-02-27 15:51:32

hurty
Member
Registered: 2004-07-17
Posts: 30

Re: Bunch of errors including a bunch of errors related to 'echo date(Y)'

thank you, phiw13 and Bloke.

Offline

Board footer

Powered by FluxBB