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

I was wondering if it is possible when I use the shortcode method via kfunctions.php that I can use the cms:embed tag?

I wrote this code:

Code: Select all
<?php

$FUNCS->register_shortcode( 'form_action', 'form_action_handler' );

function form_action_handler( $params, $content=null ){
    return '<cms:embed "form_action.html" />';
}


But it spits out this in my source code:

Code: Select all
<cms:embed "form_action.html">...</cms:embed>


The code in the html works fine if I put it directly on the page.

Thanks!
Hi,

You can use the PHP equivalent of cms:embed tag i.e. $FUNCS->embed().
I think the following code should work -
Code: Select all
function form_action_handler( $params, $content=null ){
    global $FUNCS;

    return $FUNCS->embed( 'form_action.html' );
}

As another example of using $FUNCS->embed within shortcodes, please see the '6. Obfuscate mail' example at http://docs.couchcms.com/miscellaneous/shortcodes.html

Hope it helps.
Nice, thanks!
Is it possible your solution doesn't work when Pretty URLS enabled?
My website is working fine, but on the 2 pages where I use kfunctions.php embed code, I get a blank page.

Thanks!
Nevermind, it had nothing to do with kfunctions.php file.
It was because I had a page that had the same name as a templatefile.
5 posts Page 1 of 1
cron