GetSimple Support Forum

Full Version: PHP CODE wierdness
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Why does my php code continue to be converted into a comment? I've installed DynPages and other times the code seems to work but mostly not.

In other words, when I type in this:

<?php get_i18n_navigation(return_page_slug(), minlevel, maxlevel, show); ?>

...it ends up like this:

<!--?php get_i18n_navigation(return_page_slug(), minlevel, maxlevel, show); ?-->

Any help would be appreciated.

-Don

(2013-01-26, 06:39:18)lakechicago Wrote: [ -> ]Why does my php code continue to be converted into a comment? I've installed DynPages and other times the code seems to work but mostly not.

In other words, when I type in this:

<?php get_i18n_navigation(return_page_slug(), minlevel, maxlevel, show); ?>

...it ends up like this:

<!--?php get_i18n_navigation(return_page_slug(), minlevel, maxlevel, show); ?-->

Any help would be appreciated.

-Don

OOOps. I answered my own question. The code is supposed to go in the template, not on the page.
Or in a component. That what dynpages is for.
Loading components.
Normally php code is commented out like this in the Page-Editor

<!--?php your phpCode; ?-->

This is done by the CKEditor to protect code.

I tested following solution:
Opened file "...\admin\template\ckeditor\js\config.js and
added following code at the end:

QUOTE
// Test insert  php code
CKEDITOR.editorConfig = function(config) {
 config.protectedSource.push(/<\?[\s\S]*?\?>/g); // PHP Code
 config.protectedSource.push(/<code>[\s\S]*?<\/code>/gi); // Code tags
}
UNQUOTE

Then I put following code into a test page directly (using "Source Code")
<?php echo "Hello World"; ?>  (this is not visible in the normal input)
In  the "prewiew" the Text Hello World was written (and it was not commented out...)

Somebody here said: php code or a database connection is not neccessary. I agree, but in some cases it is
an advantage, using a database for storing and editing data.

I also use the script injector plug-in from time to time for that purpose, works fine.

Any comments appreciated...