简体   繁体   中英

How can I get the value of a Typo3 template constant in PHP?

I'm quite new to Typo3 and can't seem to figure out how to get this value in PHP.

I want to be able to get to this value from either the ext_localconf.php file or the LocalConfiguration.php file.

找不到页面PID

I've trying and researching for an entire day, but I just can't find anything useful.

My end-goal is being able to set the 404 page to something other than 34. I'm working on a product with a lot of legacy code, so I'm not sure if that's a default to Typo3 or if it's something that's set by a coworker.

'pageNotFound_handling' => '/index.php?id=34'

This seemed to be hard-coded in the LocalConfiguration.php file, but I want to be able to change that id value in Typo3.

Any help or a better solution would be very much appreciated.

It's hard to get a template variable in ext_localconf.php. You should better move this variable to the extension configuration. Then it's easier to fetch the value.

See: https://docs.typo3.org/typo3cms/CoreApiReference/8.7/ExtensionArchitecture/ConfigurationOptions/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM