Posts: 10
Threads: 3
Joined: Jun 2011
2011-09-23, 02:53:13
(This post was last modified: 2011-09-23, 03:53:38 by mzzlss.)
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/...-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
Posts: 2,094
Threads: 54
Joined: Jan 2011
zig Wrote: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/...-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...
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.
Posts: 2,094
Threads: 54
Joined: Jan 2011
zig Wrote:Hi mvicek,
I have installed your plugin now and done some quick experiments. To keep things simple i started out with
Could you tell me where i define "hello_world" ?
The real nature of this is a simple contact-us type page, i just want it to send an email, but a simple example of where and how to define "hello_world" would go the distance to illustrate how to use the plugin
Kind regards,
Ben
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]; ?>
called by {% hello Joe %}.
More information on http://mvlcek.bplaced.net/get-simple/dynpages/.
Posts: 10
Threads: 3
Joined: Jun 2011
2011-09-23, 04:38:21
(This post was last modified: 2011-09-23, 04:41:11 by mzzlss.)
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
Posts: 35
Threads: 7
Joined: Oct 2011
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.
Posts: 7
Threads: 0
Joined: Oct 2011
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.
Posts: 2,928
Threads: 195
Joined: Feb 2011
Darin87 Wrote: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.
@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
Posts: 35
Threads: 7
Joined: Oct 2011
Also check the site.
Each function has working examples that are easy to duplicate.
Posts: 7
Threads: 0
Joined: Oct 2011
Connie Wrote:Darin87 Wrote: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.
@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
Thanks A Lot...
Posts: 7
Threads: 0
Joined: Oct 2011
roy_b8te Wrote:Also check the site.
Each function has working examples that are easy to duplicate. Thanks Man.. for this website...
|