comment separate php file so it appear in a div

Post here is you are having problems with any of the tutorials.
Post Reply
tiaz1988
Posts: 15
Joined: Mon Nov 09, 2015 2:30 am

comment separate php file so it appear in a div

Post by tiaz1988 »

I have made a product blog using the blog (including commenting) tutorial.
My problem is how do I do so I can download all of the comments for each post id?

In blogread.php I have made a submenu with these three links.

"Product Info", "Document" "reviwes and comments".

Then I made a div to download content for each link in the menu using jQuery function load content without refreshing.

I have also made separate files for each link,
but when I add the foreach loop for comments into reviews.php file
Shown nothing, and when I go to the page is broken.
I've tried this:

[syntax=php]

$post = get_post($_GET['pid']);

foreach($post['comments'] as $comment)
{

?>

Echo out the comments.

}
[/syntax]

I've also tried with [syntax=php]get_comments();[/syntax]

But reviews.php file does not display the comments.
How can I make comments to appear in the dynamic div
How do I insert comments for each post ID in a separate file reviews.php?

Please help me.

Thanks
tiaz1988
Posts: 15
Joined: Mon Nov 09, 2015 2:30 am

Re: comment separate php file so it appear in a div

Post by tiaz1988 »

I just want to say that I've fixed now, I played around some more and found out that I just needed to add reviews.inc.php so it seems to be a beckend file like my file to the whole blog.
Then I could display my comments for each posts in a div without to loop them in blogread.php flie. :D

Take care!
Post Reply