Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
Hi,

I need to execute PHP inside editable regions, son I can insert code inside the richtext editor, for example:

<?php echo "Hello!"; ?>

If I try to insert this command, when I see the page in the browser I don't find Hello!, but the original code <?php echo "Hello!"; ?> (so it is see like normal text, with no execution).

The problem is that I need to insert dynamic links in my editable regions.

Thank you fot your help!!

Alessandro

P. S.
I'd like to modify CKeditor's config file, adding:

CKEDITOR.config.protectedSource.push(/<\?[\s\S]*?\?>/g);

So I can use PHP code, but it still does not render the code I inserted. Is it possible to add config.js in this way in CouchCMS?
Hi,

It won't be possible to execute PHP directly from within CKeditor.
However, as the preferred alternative, you may create 'shortcodes' to do this indirectly -
please see https://docs.couchcms.com/miscellaneous/shortcodes.html for details and examples.

Hope this helps.
Thank you for your reply,

I still miss a thing: I need to insert dynamic link with parameters in the URL.

So for example if I have: articles.php?id=123

In my editable region I should have a link like this "link.php?id=123" but I don't know how I can extract the id parameter. With Shortcodes I would need to pass the variable, but I can't get that parameter from the URL :-(

Is it possible?

Maybe can I get the URL parameters inside kfunctions.php? I tried but with no success.

Thank you for your help!!

Alessandro
I'd suggest you use name of a page (instead of its ID) to get the required link -
please see https://docs.couchcms.com/tags-reference/link.html

Hope this helps.
4 posts Page 1 of 1