Hello,
the owner of one of my older sites wants to have a comment utility added to each page. I intend to use Comments_XH unless someone has a better proposal.
The extension will be a bit tricky because the installation is currently based on CMS 3.1, contains a few plugins, notably xtoc, advanced search and incorporates an SMF-Forum. So for an upgrade to XH i need to verify first if the current functionality can be maintained.
As each page needs its own comment section, to my current understanding Comment_XH has to be called from the template - how? A unique name of the comment file has to be generated somehow. If i compute that from the current heading line (maybe its checksum) i will run into problems if the page is renamend or even deleted. Just brainstoming: maybe there is way to enter the call to comments_xh automativally to a page if there is none...
Has anyone done something similar where i could start with? Any other suggestions, ideas, objections?
Thanks
Beate
Calling Comment_XH in the template
Moderator: Tata
Re: Calling Comment_XH in the template
Hi Beate,
indeed a very fascinating demand! It comes down to the old problem of a missing page ID. Both the page number ($s) and the page heading/url ($h[$s]/$u[$s]) might change over time.
IMO the best solution is to use a field in the pagedata. Unfortunately there's still none readily available for such purposes, so the Comments_XH plugin or the template has to be modified for this purpose. Something like the following might suffice:
An alternative might be the use of a "custom field". This would require the user to add the definition to every page, e.g.
This solution has the advantage, that selecting the comment file in the back-end is "somewhat more intuitive" than selecting the right uniqid or an otherwise mangled name.
Christoph
indeed a very fascinating demand! It comes down to the old problem of a missing page ID. Both the page number ($s) and the page heading/url ($h[$s]/$u[$s]) might change over time.
That would not solve the problem that an invariant name for the file has to be found.beate_r wrote:maybe there is way to enter the call to comments_xh automativally to a page if there is none
IMO the best solution is to use a field in the pagedata. Unfortunately there's still none readily available for such purposes, so the Comments_XH plugin or the template has to be modified for this purpose. Something like the following might suffice:
Code: Select all
$pd = $pd_router->find_page($s);
if (empty($pd['comments_name'])) {
$pd['comments_name'] = uniqid();
$pd_router->update($s, $pd);
}
Code: Select all
#CMSimple $comments_name = 'a unique name for the current page';#
Christoph
Christoph M. Becker – Plugins for CMSimple_XH