I want to include multiple comments sections on one page using the Commentics php sript.
First I tried accomplishing this using include like so:
<div id="1">
<?php
include "comments_id1.php";
?>
</div>
<div id="2">
<?php
include "comments_id2.php";
?>
</div>
comments_id1.php:
<?php
session_start();
ob_start();
?>
[...]
<?php
$page_id = "1";
$reference = "Page One";
$path_to_comments_folder = "comments/";
define ('IN_COMMENTICS', 'true');
require $path_to_comments_folder . "includes/commentics.php";
?>
(comments_id2.php accordingly: $page_id = "2"; $reference = "Page Two")
Apparently (and it might be worth noting that I'm still pretty clueless when it comes to PHP), this doesn't work or at least leads to all kinds of troubles (e.g. "Warning: Cannot modify header information - headers already sent").
So the solution I came up with was using the <iframe> tag, like so:
<div id="1">
<iframe width="100%" src="comments_id1.php"></iframe>
</div>
<div id="2">
<iframe width="100%" src="comments_id2.php"></iframe>
</div>
Now here's my question:
Is this even a valid solution that anyone would recommend? And if so are there any major consequences (besides search engines) using <iframe> for that purpose?
If this is not the way to go, any suggestions?
Thanks!
Personally I deeply hate IFRAMEs for may reasons, so I'd recommend to stay away from them.
Have you read the Commentics' integration guide?
It seems you have to put
<?php
session_start();
ob_start();
?>
at the beginning of the pag, and
<?php
$page_id = "1";
$reference = "Page One";
$path_to_comments_folder = "comments/";
define ('IN_COMMENTICS', 'true'); //no need to edit this line
require $path_to_comments_folder . "includes/commentics.php"; //no need to edit this line
?>
where you want your comments. There's also an extended integration guide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With