PHP in page content - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16) +--- Thread: PHP in page content (/showthread.php?tid=1959) |
PHP in page content - zig - 2011-09-23 Hi, I am trying to place some PHP into a pages content in Source mode of the WYSIWYG editor. I have found a related post here http://get-simple.info/forum/topic/2370/using-php-within-the-page/ This has got me on track. I have installed Chris's Exec-PHP plugin and now i can execute PHP code within a page's content. Later in the above mentioned post the author also had a problem with CKEditor treating the PHP code wrongly, Connie suggested the addition of the CKEditor option Quote:config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP code This worked a treat to preserve the PHP code. So now after adding this i for some reason no longer have the WYSIWYG editor available. When editing a page it always shows source mode without the toolbar. Is there a way to maintain the WYSIWYG mode yet still preserve (protect?) the PHP snippets? TIA, Ben PHP in page content - mvlcek - 2011-09-23 zig Wrote:Hi, Just for your information: you may also want to look at DynPages plugin, where you put the php code into a component and then include this component (optionally passing parameters) in your page. This way you don't have problems with CKEditor messing with php code and it might save effort, if you want to include the same/similar code in multiple pages. PHP in page content - mvlcek - 2011-09-23 zig Wrote:Hi mvicek, Just go to Theme/Edit Components and create a new component hello_world with your code, e.g. Code: <?php echo "Hello World!"; ?> Another example would be a component hello with code Code: <?php global $args; echo "Hello ".$args[0]; ?> More information on http://mvlcek.bplaced.net/get-simple/dynpages/. PHP in page content - zig - 2011-09-23 Hi mvicek, Thank you for your quick response, and after some quick experimentation your solution and plugin is working great! I actually posted a question to you then deleted it as i caught onto how to do it. But in this time you had already responded so fast again! :-P Thank you so much for your help and 2nd reply (it was what i just worked out). Your plugin is nice and ur response time has been amazing Great stuff Cheers mvicek! Ben PHP in page content - roy_b8te - 2011-10-06 No matter where I place the tag in wys editor and or component in php, the hello from the above test always shows up outside all page elements. Anyone know why and how to fix this please? edit: Ok after some tinkering I was able to get it to place withing the page. The only problem now is I'm getting 2 messages/components. 1 generated in PHP and the other from the tag. I only need the tag. Thanks edit: I removed the php function call get_component() from theme template and I now only get the 'message' inline! So all is well now. PHP in page content - Darin87 - 2011-10-07 Hello All..I don't know its right place for this post or not, but i want to know that i am new in PHP programming language i want to know that, which is the best and cheap way to start leaning PHP. Thanks in Advance. PHP in page content - Connie - 2011-10-07 Darin87 Wrote:Hello All..I don't know its right place for this post or not, but i want to know that @Darin87, if you do not know where to post, post in "off topic"-section you can find a lot of php tutorials, online, for free, as books so do a search and I am sure you will find the relevant start, good luck, Connie PHP in page content - roy_b8te - 2011-10-07 Also check the site. Each function has working examples that are easy to duplicate. PHP in page content - Darin87 - 2011-10-08 Connie Wrote:Darin87 Wrote:Hello All..I don't know its right place for this post or not, but i want to know that Thanks A Lot... PHP in page content - Darin87 - 2011-10-08 roy_b8te Wrote:Also check the site.Thanks Man.. for this website... |