Inserting PHP code via Custom HTML

Hi, very interested in buying sitecake. It looks like an excelent solution for my websites.

I do have a question: in my index.php I have a few HTML building php functions (using php print). When trying to testrun PHP on your demo page/toolbar using the Custom HTML feature with a ‘print’ using the regular php open/close tags (for example: <?php '<p>this is just a test</p>'; ?> ) this doesn’t work. The PHP tags aren’t recognized. At least: not on your example page.

Javascript document.write seems to be working on your testpage though if put between script tags, and after pushing ‘publish’ and leaving edit mode.

Any comments? Will the PHP tags (and functions) work when using sitecake on a PHP website? Or is there another way to get custom php code working?
In abscense of custom plugins it would be a great help if PHP functions could be triggered via the custom HTML feature.

I meant: <?php print '<p>this is just a test</p>'; ?> as a test ofcourse :wink:

Hi, only HTML can be submitted through custom HTML feature. Sitecake can work with php files. Setup is same as with HTML files, but there are few limitations and things to know before setting it up. You can check more here: http://sitecake.com/docs/working-with-php.html. Also check configuration section: http://sitecake.com/docs/configuration.html

I’ve read those, thanks.

Is it somehow possible to insert php code too?
Or to change the custom html field to accept php also?

Hi, it’s not possible at the moment, but I don’t think that we will allow that in future anyway. It’s kind of security issue. Anything you need to render via PHP you can do it directly in file. Front end modules are for content only

I require my users to be able to render custom frontend html (for example adding a custom photo album) which can’t be done by sitecake… and they would be able to do that pretty simple by using some standard php functions I defined specifically for rendering the correct html code with custom user variable input (for example: the folder name of the photo album).

The site doesn’t have a database anyway (thus also a preference for your flat file cms) so it wouldn’t be that much of a security issue.

Rendering in file is not a solution. That would mean I as a designer would still have to do quite some content editing, besides them using sitecake to adjust text.
Adding this option (custom php, besides custom html) would add a lot more user accessable content flexibility to sitecake.

I see how it could easy up things, but it’s still a security issue adding possibility to evaluate PHP code submitted by user. Sitecake 3.0 is in development now and it will be pluggable, so there will be possibility to add custom built content types and functionalities on both client and server side. Until then, custom HTML module can be used to add different third party functionality like Facebook comments, albumizr gallery, Olark chat or snipcart shopping cart.

It isn’t even about evaluating the php code, just about being able to insert it on user accessable (sitecake content) locations in the webpage… just like it’s possible to add html now :slight_smile:
You could even turn it off by default, with the ability to have it enabled on the administrators own risk. It’s a relatively minor change but would really make a huge difference to the flexibility and usability of sitecake.

Can you tell me what the status on plugins / custom-code is? Starting to kind of require it to make SC more flexible.

Hi Andrew,

can’t tell you time frame right now. We are wrapping up page manager, and after that continuing with Sitecake v3. When work on v3 starts again we’ll know more about timelines.