GetSimple Support Forum

Full Version: php code in page body?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible to do so? Is there a "best practice" to embed php code in the body of a file?
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/
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.
you can also make different template files and pick-and-choose particular templates within the Edit screen's "Page Options" button
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.

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.
(2018-01-10, 21:55:49)lotova Wrote: [ rel="nofollow" -> ]
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/