Share » Forums » General » Add comments to image.tpl?

Add comments to image.tpl?

Add comments to image.tpl?

Saturday 14 May 2011 7:12:24 am - 3 replies

Author Message

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!

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu