Execute PHP code in HTML-Bloock possible?

Permalink 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 &quot;PHPCodeBlockController&quot; 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:

Any suggestions?


View Replies:
jgarcia replied on at Permalink Reply
The HTML code cannot execute PHP. If the PHP code block is not working for you, you could contact the developer of that block...they should probably get that fixed anyways :)

Outside of that, you would need to use single pages or find another block to help you accomplish whatever you are trying to do.
Remo replied on at Permalink Reply
There's this block as well:

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.
melat0nin replied on at Permalink Reply
Hi Remo

Your block doesn't seem to be working in concrete 5.4.2 - any ideas how to fix it?

Remo replied on at Permalink Reply
Can you please be a bit more precise? What doesn't work? Can't you add it? Is there an error message?
melat0nin replied on at Permalink Reply
Hi Remo

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.
Remo replied on at Permalink Reply
I don't think the example I've posted on codeblog is wrapped in a package, it's just a block, nothing else.

But that's not related to 5.4.2.. Just try to copy it to /blocks as see if that changes anything!
melat0nin replied on at Permalink Reply
Hi Remo

You're right, it's just a block and works by putting it in the blocks/ directory (and i'm an idiot!)
jpullman replied on at Permalink Reply
Just wanted to say, thanks a lot. I really needed this and it worked out for me.
pvernaglia replied on at Permalink Reply