Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
php code in page body?
#1
Is it possible to do so? Is there a "best practice" to embed php code in the body of a file?
Reply
#2
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/
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#3
Another nice one is DynPages: http://get-simple.info/forum/topic/1360/...es-plugin/
Reply
#4
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.
Reply
#5
you can also make different template files and pick-and-choose particular templates within the Edit screen's "Page Options" button
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#6
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.

Reply
#7
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.
Reply
#8
(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/
Reply




Users browsing this thread: 1 Guest(s)