This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Commentics in Smarty TPL file?
#1

Has anyone managed to pass the php commentics code to a smarty tpl file successfully?

I tried it as a php function, php code inside tpl, etc. but couldnt get it to work.

Please post your code here if you managed to do it.
Thanks
Reply
#2

Hey.

Yes, I solved this. Here's the method:

Assuming $smarty is your Smarty object.

1) Get the comments html-code
Code:
// Start the output buffer
ob_start();
// Commentics configuration
$cmtx_page_id = "pageid";
$cmtx_reference = "Page title";
$cmtx_path = "/path/to/your/commentics/root/";
define ('IN_COMMENTICS', 'true');
// Call commentics
require $cmtx_path . "includes/commentics.php";
// Grab code from the output buffer
$comments_html = ob_get_clean();

2) Put the html into your smarty template object
Code:
// Assign code to a template variable
$smarty->assign("comments_html",$comments_html);

3) Display it somewhere in your template files
Code:
{$comments_html}
Reply
#3

Could you give a little more detail as to how you implement in the smarty folder structure, i get part 3) but where does the rest of the code go? do you make a function or something?
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Steven
19-Feb-2020, 10:26 AM
Last Post by kbadmin
28-May-2019, 07:16 PM
Last Post by news
18-Dec-2017, 09:15 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)