ImTopic
Kind: global class
Summary: Manage the user messages in a topic or discussion.
To use it, you must include x5engine.php in your code.
- ImTopic
- new ImTopic($id, $basepath, $postUrl)
- .setCommentsPerPage($n) ⇒
Void
- .setPostUrl($posturl) ⇒
Void
- .setTitle($title) ⇒
Void
- .loadXML($folder) ⇒
Void
- .saveXML($folder) ⇒
Boolean
- .loadDb($host, $user, $pwd, $db, $table) ⇒
Void
- .saveDb($host, $user, $pwd, $db, $table) ⇒
Boolean
- .showForm($rating, $captcha, $moderate, $email, $type, $moderateurl) ⇒
Void
- .showSummary($rating, $admin, $hideifempty) ⇒
Void
- .showComments($page, $commentsPerPage, $rating, $order, $showabuse, $hideifempty) ⇒
Void
- .showPagination($page) ⇒
Void
- .showRating() ⇒
Void
new ImTopic($id, $basepath, $postUrl)
Create a new instance of ImTopic class
Param | Type | Description |
---|---|---|
$id | String |
The topic id |
$basepath | String |
The base path |
$postUrl | String |
The URL to post to |
.setCommentsPerPage($n) ⇒ Void
Set the number of comments to show in each page
Kind: instance method of ImTopic
Param | Type |
---|---|
$n | Number |
.setPostUrl($posturl) ⇒ Void
Set the path to wich the data is posted to when a message is submitted
Kind: instance method of ImTopic
Param | Type |
---|---|
$posturl | String |
.setTitle($title) ⇒ Void
Set the title of this topic
Kind: instance method of ImTopic
Param | Type |
---|---|
$title | String |
.loadXML($folder) ⇒ Void
Load the data from the xml file contained in the specified folder.
The filename of this topic is automatically calculated basing on the topic's id to provide a major lever of security.
Kind: instance method of ImTopic
Param | Type | Description |
---|---|---|
$folder | String |
The file's folder |
.saveXML($folder) ⇒ Boolean
Save the data to an xml file in the provided folder.
The filename of this topic is automatically calculated basing on the topic's id to provide a major lever of security.
Kind: instance method of ImTopic
Returns: Boolean
- True if the file is saved correctly
Param | Type | Description |
---|---|---|
$folder | String |
The folder where is saved the file |
.loadDb($host, $user, $pwd, $db, $table) ⇒ Void
Load the data from the database.
This method is available only in the Professional edition.
Kind: instance method of ImTopic
Param | Type | Description |
---|---|---|
$host | String |
The dbname |
$user | String |
The db user name |
$pwd | String |
The db user password |
$db | String |
The db name |
$table | String |
The db table |
.saveDb($host, $user, $pwd, $db, $table) ⇒ Boolean
Save the comments to a database.
This method is available only in the Professional edition.
Kind: instance method of ImTopic
Returns: Boolean
- True if the comments are saved correctly
Param | Type | Description |
---|---|---|
$host | String |
The dbname |
$user | String |
The db user name |
$pwd | String |
The db user password |
$db | String |
The db name |
$table | String |
The db table |
.showForm($rating, $captcha, $moderate, $email, $type, $moderateurl) ⇒ Void
Show the comments form
Kind: instance method of ImTopic
Param | Type | Description |
---|---|---|
$rating | Boolean |
true to show the rating |
$captcha | Boolean |
true to enable captcha |
$moderate | Boolean |
true to enable the moderation |
String |
the email address to notificate | |
$type | String |
guestbook or blog |
$moderateurl | String |
The url at wich is possible to moderate the new comments |
.showSummary($rating, $admin, $hideifempty) ⇒ Void
Show the topic summary
Kind: instance method of ImTopic
Param | Type | Description |
---|---|---|
$rating | Boolean |
TRUE to show the ratings |
$admin | Boolean |
TRUE to show approved and unapproved comments |
$hideifempty | Boolean |
true to hide the summary if there are no comments |
.showComments($page, $commentsPerPage, $rating, $order, $showabuse, $hideifempty) ⇒ Void
Show the comments list
Kind: instance method of ImTopic
Param | Type | Description |
---|---|---|
$page | Number |
The page to show |
$commentsPerPage | Number |
The number of comments to show for each page |
$rating | Boolean |
True to show the ratings |
$order | String |
desc or asc |
$showabuse | Boolean |
True to show the "Abuse" button |
$hideifempty | Boolean |
True to hide the summary if there are no comments |
.showPagination($page) ⇒ Void
Show the pagination links for this topic
Kind: instance method of ImTopic
Param | Type | Description |
---|---|---|
$page | Number |
Page number |
.showRating() ⇒ Void
Show a single rating form
Kind: instance method of ImTopic