GetSimple Support Forum
php code in page body? - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Installation & Setup (http://get-simple.info/forums/forumdisplay.php?fid=5)
+--- Thread: php code in page body? (/showthread.php?tid=1625)



php code in page body? - ash - 2011-04-30

Is it possible to do so? Is there a "best practice" to embed php code in the body of a file?


php code in page body? - ccagle8 - 2011-04-30

you can either add it to the template file within your theme you are using, or you can use the exec php plugin to add it to your body content: http://get-simple.info/extend/plugin/exec-php/17/


php code in page body? - Carlos - 2011-04-30

Another nice one is DynPages: http://get-simple.info/forum/topic/1360/dynpages-plugin/


php code in page body? - ash - 2011-04-30

ccagle8 Wrote:you can either add it to the template file within your theme you are using, or you can use the exec php plugin to add it to your body content: http://get-simple.info/extend/plugin/exec-php/17/

Awesome. The template will make it visible in all pages. But the plugin will allow custom changes per file (I assume) so I'm guessing the exec-php is definitely a better approach.


php code in page body? - ccagle8 - 2011-04-30

you can also make different template files and pick-and-choose particular templates within the Edit screen's "Page Options" button


RE: php code in page body? - lotova - 2018-01-10

Hi, I'd like to know how to use the Exec-PHP plugin along with CKEditor.

The plugin works well at first glance - if I insert for example <?php echo getrandmax(); ?> in source-editing mode through the editor the page displays correctly 2147483647. But if I edit the same page (anywhere else) the editor automatically replaces the above mentioned php code with <!--?php echo getrandmax() ?--> and there is a blank place instead of the number in the webpage then.

This way the Exec-PHP plugin is unusable. Is it necessary to somehow reset the editor so that this plugin can be used?
Thank you.




RE: php code in page body? - Bigin - 2018-01-10

Do not use the CKEditor for this purpose, turn it off completely in settings.
Another option is DynPages and components with your PHP snippets. Or use simple short codes/placeholders like {% your_data %} in editor and replace them with variables in your template file.


RE: php code in page body? - Oleg06 - 2018-01-10

(2018-01-10, 21:55:49)lotova Wrote:
Hi, I'd like to know how to use the Exec-PHP plugin along with CKEditor.

The plugin works well at first glance - if I insert for example <?php echo getrandmax(); ?> in source-editing mode through the editor the page displays correctly 2147483647. But if I edit the same page (anywhere else) the editor automatically replaces the above mentioned php code with <!--?php echo getrandmax() ?--> and there is a blank place instead of the number in the webpage then.

This way the Exec-PHP plugin is unusable. Is it necessary to somehow reset the editor so that this plugin can be used?
Thank you.


I recommend using the plugin DynPages. http://get-simple.info/extend/plugin/dynpages/81/