Post Reply 
Commentics in Smarty TPL file?
11-Apr-2012, 01:05 AM
Post: #1
Commentics in Smarty TPL file?
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
Find all posts by this user
Quote this message in a reply
10-Aug-2012, 08:32 PM
Post: #2
RE: Commentics in Smarty TPL file?
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}
Find all posts by this user
Quote this message in a reply
09-Oct-2012, 04:11 PM
Post: #3
RE: Commentics in Smarty TPL file?
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?
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Binding Commentics to specific page on site johndoe694 2 133 12-Apr-2013 02:11 PM
Last Post: johndoe694
  Keeping SEO URLs with Commentics pier 11 871 31-Mar-2013 02:44 PM
Last Post: CaptainAlex
Star How to integrate Commentics to a subdomain page? page 1 335 04-Jan-2013 07:26 AM
Last Post: page
  commentics and subdomain problem ludo 0 240 13-Dec-2012 09:11 PM
Last Post: ludo
  How to insert the code in a php file? kevinclark 0 355 23-Oct-2012 09:43 PM
Last Post: kevinclark
  Error in Smarty compiler in cms CommiC 5 656 13-Aug-2012 10:16 PM
Last Post: CommiC
  Pathname to the File that inserts the Comments Box Bill 10 1,093 23-Jun-2012 11:46 PM
Last Post: Bill
  commentics in php function rolz 2 681 04-Mar-2012 11:22 AM
Last Post: hosts
  Commentics sometimes shows up/sometimes doesn't mdniaz 1 446 19-Dec-2011 12:38 PM
Last Post: Steven
  Wordpress + Commentics bcb 2 849 28-Sep-2011 10:30 AM
Last Post: utaka

Forum Jump:


User(s) browsing this thread: 1 Guest(s)