Home Forums Weaver Xtreme Theme PHP and require_once Reply To: PHP and require_once


OK, and apologies: there does seem to be an issue with multi-line php scripts. Don’t know when that got in there, and I don’t have any quick solution.

There must have been some changes in the underlying mechanism Weaver’s [php] handler uses. I searched for alternate PHP code plugins, and it seems that some previous plugins that used to be there that were similar to Weaver’s [php] are no longer available.

There seem to be a couple other plugins that support PHP code by requiring adding snippets to a separate admin interface, and then specifying a snippet reference rather than actual PHP code in the page/post. There also is a PHP plugin that provides a new block for the block editor.

(See next post regrading retraction. Multiline requires classic editor Text view PLUS Raw per page setting.)

But there is an easy work around that is easier to maintain for now. Rather than try to make a long single line string, simply add multiple lines wrapped by the [php]//code[/php]:

[php]echo "THIS IS GENERATED BY A PHP ECHO";[/php]
[php]echo "2. THIS IS GENERATED BY A PHP ECHO";[/php]
[php]echo "3. THIS IS GENERATED BY A PHP ECHO";[/php]

At this point, I would highly recommend trying one of the other PHP plugins, perhaps

Insert PHP Code Snippet

BUT, as I’ve said all along, you still have to have valid PHP code. And the code you have with [php]require_once ‘php/glob.php’;[/php] will still fail because of what I previously explained. The error message you got was still caused by the require_once which needs a full path to where ever the glob.php file is.