Execute PHP code in HTML-Bloock possible?1 user found helpful
I am not able to execute any PHP-Code within my (themed) site.
I am using c5.4.1 with theme Earthling Two
I use the HTML-Block for that and edited e.g.
<?php echo "Hello World."; ?>
The Problem is, when I look into the source code of my page it looks like:
<div id="HTMLBlock92" class="HTMLBlock">
<?php echo "Hello World."; ?></div>
It's just not beeing executed, I can see nothing.
With any php code I do.
I tried the a block called "PHP Code" but I get the following error message on my page:
Fatal error: View::render() [<a href='view.render'>view.render</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "PHPCodeBlockController" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /kunden/120987_64546/rp-hosting/8390/10160/concrete5/concrete/libraries/view.php on line 734
You can try for yourself here:
Outside of that, you would need to use single pages or find another block to help you accomplish whatever you are trying to do.
In case you don't speak German, there's a download in the last page which links to this:
You can't enter the code in the block dialog but that would make it a bit dangerous. Imagine if your customer could execute any php code on your server. The block works by executing PHP files which you have to create on the file system.
Your block doesn't seem to be working in concrete 5.4.2 - any ideas how to fix it?
Sorry, yes, I should have been more specific. When I upload the block's directory to packages/ on my server it doesn't appear in the Add Functionality screen of the Dashboard. I've checked the permissions and they seem fine (755).
I'm running a fresh installation of 5.4.2.
But that's not related to 5.4.2.. Just try to copy it to /blocks as see if that changes anything!
You're right, it's just a block and works by putting it in the blocks/ directory (and i'm an idiot!)