Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP on Pages
#1
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.
Reply
#2
There is a plugin for this in the extend repository called exec-php
http://get-simple.info/extend/plugin/exec-php/17/
Reply
#3
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).
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#4
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.
Author of GetSimple 3's Finnish Language file — http://get-simple.info/extend/language/f...guage/106/
Reply
#5
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.
- 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
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 ;-)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#7
@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/
- 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
#8
Thanks a lot for this very fast support! You're great!
Reply




Users browsing this thread: 2 Guest(s)