Re: Guestbook

[email protected] (mikespub) Wed, 10 Sep 2003 15:59:37 GMT
Newsgroups gmane.comp.cms.xaraya.knowledge-base
Organization not much
Message-ID <[email protected]>
In article <bjjagn$bf6$1-111RdWWlOxkOkXtL6OYfHgC/[email protected]>, [email protected] (Banzai) wrote:
>I would like to make a guestbook... but dont really know how.
>
>googling the net and found this:
>
>http://lists.xaraya.com/pipermail/xaraya_users/2003-May/000277.html
>
>How should I go about? comments, pointers appreciated. TIA
>
>Banzai
>

Well, re-using the comments module you could for instance do the following :

1) in modules/base/xaruser/main.php [my favourite test spot :)], change
the main function as follows :

function base_user_main()
{
// Security Check
    if(!xarSecurityCheck('ViewBase')) return;

    xarTplSetPageTitle(xarML('Welcome'));

    $data = array();
    $data['hooks'] = xarModCallHooks('item', 'display', 1,
                                     array('returnurl' => xarModURL('base'),
                                           'module' => 'base'));
    //return the output
    return $data;
}

This will call any display hooks for a fake item 1 of the base module.

2) via Modules -> Configure Hooks -> Comments, enable the comments
hook for the base module

3) in themes/Xaraya_Classic/modules/base/user-main.xt (or equivalent
template in your theme), add the following :

<xar:if condition="!empty($hooks['comments'])">
    #$hooks['comments']#
</xar:if>

You'll see comments appear in the base page, so users can add comments,
reply to others if they want etc.

For a more customized approach, you could call the comments APIs yourself,
like the xarbb module does for example. Or create a new publication type in
articles, as discussed in that original message...

Mike.