Forums / General / Add comments to image.tpl?

Add comments to image.tpl?

Author Message

Neo Pixel

Saturday 14 May 2011 7:12:24 am

Hi,

I'd like to add the same comments functionality from the article and blog post classes to the image class via (i assume) the image.tpl

can someone please help with the procedure and the code i have to add to image.tpl

thanks in advance :)

Asking stupid questions so you don't have to!

Romeo Antony

Sunday 15 May 2011 2:40:04 am

Hi Neo,

to add comment functionality to image class,

* extend the image class with a new atrribute of type checkbox.

example Name:

Enable comments

Identifier:

enable_comments

then try the following code in full template view of image class

{* Should we allow comments? *}
{section show=is_unset( $versionview_mode )}
{section show=$node.data_map.enable_comments.content}
<h2>{"Comments"|i18n("design/base")}</h2>
<div class="content-view-children">
{section name=Child loop=fetch_alias( comments, hash( parent_node_id, $node.node_id ) )}
{node_view_gui view='line' content_node=$:item}
{/section}
</div>
{* Are we allowed to create new object under this node? *}
{if fetch( content, access,
hash( access, 'create',
contentobject, $node,
contentclass_id, 'comment' ) )}
<form method="post" action={"content/action"|ezurl}>
<input type="hidden" name="ClassIdentifier" value="comment" />
<input type="hidden" name="NodeID" value="{$node.node_id}" />
<input class="new_comment button" type="submit" name="NewButton" value="{'New Comment'|i18n( 'design/base' )}" />
</form>
{else}
<h3>{"You are not allowed to create comments."|i18n("design/base")}</h3>
{/if}
{/section}
{/section}

Regards

Romeo

Neo Pixel

Saturday 28 May 2011 4:11:27 am

Many Thanks Romeo I'll give it a try :)

Asking stupid questions so you don't have to!

Neo Pixel

Saturday 28 May 2011 4:38:14 am

Hi Romeo,

That works great, thank you

One thing. how do i link "You are not allowed to create comments." to the registration form?

Many thanks in advance :)

Asking stupid questions so you don't have to!