Skip to main content Help Control Panel

Aubagne HipHop

Tout le Hip Hop d'Aubagne et des alentours

Home «   Server software «  

Documentation: comments/comments.php

Class Comments - The database abstraction layer for comments

Comments are not intended to create complex threading systems. They are more or less to be used as sticky notes aside published pages.

At the moment YACS supports following comment types:

This script is a reference file of this system.

Licence: GNU Lesser General Public License

Auteurs:

are_allowed() - Check new comments are allowed

function are_allowed()

Allows for new comments when:

delete() - Delete one comment

function delete($id)



Voir aussi:

delete_for_anchor() - Delete all comments for a given anchor

function delete_for_anchor($anchor)



Voir aussi:

get() - Get one comment by id

function &get($id)



Voir aussi:

get_img() - Get a element

function get_img($type)



Voir aussi:

get_next_url() - Get id of next comment

function get_next_url($item, $anchor, $order='date', $capability='?')

This function is used to build navigation bars.

Voir aussi:

get_options() - Get types as options of a <SELECT> field

function get_options($type)



Voir aussi:

get_previous_url() - Get id of previous comment

function get_previous_url($item, $anchor, $order='date', $capability='?')

This function is used to build navigation bars.

Voir aussi:

get_radio_buttons() - Get types as radio buttons

function get_radio_buttons($name, $type)



Voir aussi:

get_title() - Get a default title from the type selected

function get_title($type)

get_url() - Get the url to view a comment

function get_url($id, $action='view')

By default, a relative URL will be provided (e.g. 'comments/view.php?id=512'), which may be not processed correctly by search engines. If the parameter 'with_friendly_urls' has been set to 'Y' in the configuration panel, this function will return an URL parsable by search engines (e.g. 'comments/view.php/512').

Voir aussi:

list_by_date() - List newest comments

function &list_by_date($offset=0, $count=10, $variant='date')

To build a simple box of the newest comments in your main index page, just use the following example:
// side bar with the list of most recent comments
include_once 'comments/comments.php';
$local['title_en'] = 'Most recent comments';
$local['title_fr'] = 'commentaires r&eacute;cents';
$title i18n::user('title');
$items Comments::list_by_date(010);
$text Skin::build_list($items'compact');
$context['text'] .= Skin::build_box($title$text'navigation');


You can also display the newest comment separately, using Comments::get_newest() In this case, skip the very first comment in the list by using Comments::list_by_date(1, 10)

Voir aussi:

list_by_date_for_anchor() - List newest comments for one anchor

function &list_by_date_for_anchor($anchor, $offset=0, $count=20, $variant='no_anchor', $capability='?')

If variant is 'compact', the list start with the most recent comments. Else comments are ordered depending of their edition date.

Example:
include_once 'comments/comments.php';
$items Comments::list_by_date_for_anchor('section:12'010);
$context['text'] .= Skin::build_list($items'compact');


Voir aussi:

list_by_date_for_author() - List newest comments for one author

function &list_by_date_for_author($author_id, $offset=0, $count=20, $variant='date')

Example: include_once 'comments/comments.php'; $items = Comments::list_by_date_for_author(12, 0, 10); $context['text'] .= Skin::build_list($items, 'compact');

list_next() - List next comments in thread

function &list_next($id, $variant='date')



Voir aussi:

list_selected() - List selected comments

function &list_selected(&$result, $variant='compact', $capability='?')

Accept following layouts:

list_threads_by_count() - Thread comments by numbers

function &list_threads_by_count($offset=0, $count=10, $variant='date')

Result of this query should be processed with a layout adapted to articles

Voir aussi:

list_threads_by_count_for_anchor() - Thread comments by umbers for given anchor

function &list_threads_by_count_for_anchor($anchor, $offset=0, $count=10, $variant='date', $capability='?')

Result of this query should be processed with a layout adapted to articles

Voir aussi:

list_threads_by_date() - Thread newest comments

function &list_threads_by_date($offset=0, $count=10, $variant='date')

Result of this query should be processed with a layout adapted to articles

Voir aussi:

list_threads_by_date_for_anchor() - Thread newest comments

function &list_threads_by_date_for_anchor($anchor, $offset=0, $count=10, $variant='date', $capability='?')

Result of this query should be processed with a layout adapted to articles

Voir aussi:

post() - Post a new comment or an updated comment

function post($fields)

The surfer signature is also appended to the comment, if any.

On error this script updates $context['error'].

Voir aussi:

search() - Search for some keywords in all comments

function &search($pattern, $offset=0, $count=10, $variant='search')



Voir aussi:

setup() - Create tables for comments

function setup()

Voir aussi:

stat() - Get some statistics

function &stat()



Voir aussi:

stat_for_anchor() - Get some statistics for one anchor

function &stat_for_anchor($anchor, $capability='?')



Voir aussi:

stat_threads() - Get some statistics on threads

function &stat_threads()



Voir aussi:

Tools
Browse the source of this script
Server software