GetSimple Support Forum
PHP on Pages - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Feature Requests (http://get-simple.info/forums/forumdisplay.php?fid=7)
+--- Thread: PHP on Pages (/showthread.php?tid=1438)



PHP on Pages - ePirat - 2011-03-21

Hello, I hope I am right here...
I really like GetSimple and it is a great small content management system.
I am using the Beta Version 3.0 and I discovered that i can use PHP Code in the sidebar, but not on pages.
Is there a way to enable using PHP code on pages? It would make a lot of things easier for me.

Thanks, Marvin S.


PHP on Pages - mikeh - 2011-03-21

There is a plugin for this in the extend repository called exec-php
http://get-simple.info/extend/plugin/exec-php/17/


PHP on Pages - mvlcek - 2011-03-21

mikeh Wrote:There is a plugin for this in the extend repository called exec-php
http://get-simple.info/extend/plugin/exec-php/17/

Or, if you need to include the same or similar code on many pages, put the code into a new component (Themes/Components) and include the component using the DynPages plugin (you can even pass parameters to the component).


PHP on Pages - krisu - 2011-03-21

One another way also is making edited template.php in the theme folder, that has this code
Code:
<?php get_page_content(); ?>

replaced with PHP code that you want.

Save that file as something else in same folder (like form.php)

Then you create a new page in Page Management, click "Page options", select that edited template from "template" menu.


It's least hacky and non-plugin way, but updating themes would be little bit pain if you have lot of these files.


PHP on Pages - ccagle8 - 2011-03-21

I prefer krisu's method because I feel it's just cleaner when there is a lot of PHP that needs to be inserted. If you are just needing to add one PHP <?php ?> tag into your content, then PHP-Exec is the way to go.

Anything more than that I would suggest creating a new template.


PHP on Pages - mvlcek - 2011-03-21

ccagle8 Wrote:I prefer krisu's method because I feel it's just cleaner when there is a lot of PHP that needs to be inserted.

This is not possible, if you want to include the dynamic part within the page content (text before and after the dynamic content). And - as krisu mentioned - a pain, if you have multiple template files and need to change them - and change them you WILL ;-)

ccagle8 Wrote:If you are just needing to add one PHP <?php ?> tag into your content, then PHP-Exec is the way to go.

That's only possible, if the user who's editing pages has a basic idea of PHP. Otherwise I'd rather create a component with the code and tell him to use {% mycomponent %} to include it anywhere he wants.

Also, if it's used multiple times and you put it into one component, you only have to change it once. And before you argue about that: The user WILL request a change and you WILL have to change it ;-)

ccagle8 Wrote:Anything more than that I would suggest creating a new template.

See first option.

So my favorite is the DynPages plugin ;-)


PHP on Pages - ccagle8 - 2011-03-21

@mvlcek - all preferences... I prefer to do it the way I suggested - but someone else can have other preferences. These two pages are hardcoded because I would prefer to work in code rather than the HTML editor window. Most non-dev people would prefer to probably not do that.

http://get-simple.info/start/cms-comparisons/
http://get-simple.info/start/screenshots/


PHP on Pages - ePirat - 2011-04-23

Thanks a lot for this very fast support! You're great!