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

Comments on separate page from form
#1

How do I set the script so that the comments will display on a separate page from the form? I tired this on page two but it did not work.

<?php
define ('IN_COMMENTICS', 'true');
require "includes/db/connect.php";
require "includes/functions/page.php";
require "includes/functions/comments.php";
$page_id = "2";
$page_id = cmtx_sanitize($page_id, true, true, true);
echo cmtx_number_of_comments(10);
echo "<br/>";
echo cmtx_average_rating();
?>
Reply
#2

Hi,

It's not really designed to be broken apart like that.

The best way might be to include the script like normal, but set a flag like:

PHP Code:
<?php
define
('SHOW_COMMENTS_ONLY', 'true');
$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
?>

Then in /comments/includes/commentics.php:

Replace this:
PHP Code:
<?php 
if ($settings->sort_order_parts == "1,2") {
require_once
$path_to_comments_folder . "includes/template/comments.php"; //display comments
echo "<div class='height_for_divider'></div>"; //display divider
require_once $path_to_comments_folder . "includes/template/form.php"; //display form
} else {
require_once
$path_to_comments_folder . "includes/template/form.php"; //display form
echo "<div class='height_for_divider'></div>"; //display divider
require_once $path_to_comments_folder . "includes/template/comments.php"; //display comments
}

With this:
PHP Code:
<?php 
if ($settings->sort_order_parts == "1,2") {
require_once
$path_to_comments_folder . "includes/template/comments.php"; //display comments
if (!defined("SHOW_COMMENTS_ONLY")) {
echo
"<div class='height_for_divider'></div>"; //display divider
require_once $path_to_comments_folder . "includes/template/form.php"; //display form
}
} else {
if (!
defined("SHOW_COMMENTS_ONLY")) {
require_once
$path_to_comments_folder . "includes/template/form.php"; //display form
echo "<div class='height_for_divider'></div>"; //display divider
}
require_once
$path_to_comments_folder . "includes/template/comments.php"; //display comments
}

I haven't tested it so I can't say for sure whether it will work. I know there will at least be a problem with the reply link.

Have you completed the interview?
Reply
#3

Can you help v:2.3 please?

These lines 2.3 do not

Sorry for bad english Smile
Reply
#4

For v2.3 (and v2.4), open /comments/includes/template/main.php

Replace this (lines 46-48):

PHP Code:
<?php 
require_once $cmtx_path . "includes/template/comments.php"; //load comments
echo "<div class='cmtx_height_for_divider'></div>"; //height between comments/form
require_once $cmtx_path . "includes/template/form.php"; //load form

With this:

PHP Code:
<?php 
require_once $cmtx_path . "includes/template/comments.php"; //load comments
if (!defined("SHOW_COMMENTS_ONLY")) {
echo
"<div class='cmtx_height_for_divider'></div>"; //height between comments/form
require_once $cmtx_path . "includes/template/form.php"; //load form
}

And this (lines 70-72):

PHP Code:
<?php 
require_once $cmtx_path . "includes/template/form.php"; //load form
echo "<div class='cmtx_height_for_divider'></div>"; //height between form/comments
require_once $cmtx_path . "includes/template/comments.php"; //load comments

With this:

PHP Code:
<?php 
if (!defined("SHOW_COMMENTS_ONLY")) {
require_once
$cmtx_path . "includes/template/form.php"; //load form
echo "<div class='cmtx_height_for_divider'></div>"; //height between form/comments
}
require_once
$cmtx_path . "includes/template/comments.php"; //load comments

Have you completed the interview?
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Tim
06-Jan-2021, 08:56 PM
Last Post by Tim
18-Oct-2019, 11:45 AM
Last Post by Gevill
23-Jul-2019, 01:17 AM
Last Post by Steven
16-Feb-2018, 09:15 AM
Last Post by Wendon
20-Nov-2017, 03:36 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)