Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

showcomments

Display comments matching the given $ctype and $cid and the ability to post / edit / delete comments.

showcomments

Quote

showcomments ( string $ctype , string $cdb, string $ccol , int $cid , string $clink )


Parameters
ctype
The comment type you want to display.
Used ctypes by Core are N for News, A for Articles, P for Photos, D for Downloads, C for Custom Pages.
The ctype can be 2 chars long.

cdb
The database table where the item you want to comment on resides in.

ccol
The field in the table which holds the id for the item you want to comment on.

cid
The actual id to the item you are commenting on.

clink
The url for the page which holds the item, this is used for the navigation and should not end with ? or &!

Return Values
This function will return the comments matching the given $type and $cid from the $cdb.
If the user is a member the user will be able to post a comment if not, it will display a message telling the user to log in or register in order to post a comment.

Examples

Code
<?php
// Used to show comments in news
showcomments("N", DB_NEWS, "news_id", $_GET['readmore'], FUSION_SELF."?readmore=".$_GET['readmore']);
?>


Code
<?php
// Show comments in articles
showcomments("A", DB_ARTICLES, "article_id", $_GET['article_id'], FUSION_SELF."?article_id=".$_GET['article_id']);
?>


Changelog
7.01.00 - Global comments_enabled settings added to be able to disable all comments from the admin panel.
7.00.00 - In PHP-Fusion v6 the DB_PREFIX was automatically added to the $cdb, but with the new Multisite Include in PHP-Fusion v7 this was removed and the complete database table with DB_PREFIX is needed, this is important to remember when updating infusions from v6 to v7.


See also …


References