Path

ez projects / powercontent / forum / general / how to include comment form...


How to include comment form in a template

You need to be logged in to post messages in the forums. New users may register here.

Pascal France

Member since:
09 January 2008

Posts: 12

Wednesday 21 October 2009 12:54:06 am

Hi,

I want to display the comment form at the bottom of the blog post (ezwebin & eZ Publish 4.2 & powercontent svn).

I followed this article:
http://www.ezsystems.ca/blog/ez_p...ts_making_commenting_more_accessible
wich is exactly what I want to achieve.

First, if the attributes of my comment class are requiered, the system never validate them and I'm redirected to the comment edit view.

Second, if any atribute are requiered, the comment is well created but is empty.

This is my blog_post.tpl



<!-- DEFAULT CODE TEMPLATE -->


{* Blog post - Full view *}


{set scope=global persistent_variable=hash('left_menu', false(),


                                          'extra_menu', false())}


 

<div class="class-blog extrainfo">


   <div class="columns-blog float-break">


       <div class="main-column-position">


           <div class="main-column float-break">


               <div class="border-box">


               <div class="border-tl"><div class="border-tr"><div class="border-tc"></div></div></div>


               <div class="border-ml"><div class="border-mr"><div class="border-mc float-break">


                       <div class="content-view-full">


                           <div class="class-blog-post float-break">


                               <div class="attribute-header">


                                   <h1>{$node.data_map.title.content|wash}</h1>


                               </div>


                               <div class="attribute-byline">


                                   <p class="date">{$node.data_map.publication_date.content.timestamp|l10n(shortdatetime)}</p>


                                   <p class="author">{$node.object.owner.name}</p>


                                   <p class="tags"> {"Tags:"|i18n("design/ezwebin/full/blog_post")}


                                        {foreach $node.data_map.tags.content.keywords as $keyword}


                                            <a href={concat( $node.parent.url_alias, "/(id)/", $node.parent.node_id, "/(tag)/", $keyword|rawurlencode )|ezurl} title="{$keyword}">{$keyword}</a>


                                            {delimiter}


                                              ,


                                            {/delimiter}


                                        {/foreach}


                                   </p>


                               </div>


                               <div class="attribute-body float-break">


                                   {attribute_view_gui attribute=$node.data_map.body}


                               </div>


                               {include uri='design:parts/related_content.tpl'}


                           </div>


                       </div>


               </div></div></div>


               <div class="border-bl"><div class="border-br"><div class="border-bc"></div></div></div>


               </div>


           </div>


       </div>


       <div class="extrainfo-column-position">


           <div class="extrainfo-column">


               <div class="border-box">


               <div class="border-tl"><div class="border-tr"><div class="border-tc"></div></div></div>


               <div class="border-ml"><div class="border-mr"><div class="border-mc float-break">


                       {include uri='design:parts/blog/extra_info.tpl' used_node=$node.parent}


               </div></div></div>


               <div class="border-bl"><div class="border-br"><div class="border-bc"></div></div></div>


               </div>


           </div>


       </div>


   </div>


</div>


<!-- END DEFAULT CODE TEMPLATE -->


 

<!- POWERCONTENT CODE -->


<div class="class-comment">


  <form method="post" action={"powercontent/action"|ezurl} >


     <div class="attribute-header">


        <h1 class="long">New Comment</h1>


     </div>


  {* def $current_user=fetch( 'user', 'current_user' )*}


  {*if $current_user.is_logged_in*}


  {* <input type="hidden" name="powercontent_author_ContentObjectAttribute_ezstring_data_text_pcattributeid" value="{$current_user.contentobject.name|wash}" />


       <input type="hidden" name="powercontent_email_ContentObjectAttribute_data_text_pcattributeid" value="{$current_user.email|wash}"/> *}


  {* else *}


     <div class="block">


        <label>Name (required)</label><div class="labelbreak"></div>


        <input class="box" type="text" size="70" name="powercontent_author_ContentObjectAttribute_ezstring_data_text_pcattributeid" value="" />


     </div>


     <div class="block">


        <label>Email address (required) (will not be published)</label><div class="labelbreak"></div>


        <input class="box" type="text" size="70" name="powercontent_email_ContentObjectAttribute_data_text_pcattributeid" value="" />


     </div>


  {* /if *}


     <div class="block">


        <label>Website</label><div class="labelbreak"></div>


        <input class="box" type="text" size="70" name="powercontent_url_ContentObjectAttribute_ezurl_url_pcattributeid" value="" />


     </div>


     <div class="block">


        <label>Subject (required)</label><div class="labelbreak"></div>


        <input type="hidden" name="NodeID" value="175" />


        <input type="hidden" name="ClassID" value="13" />


        <input type="hidden" name="DoPublish" value="yes" />


        <input type="hidden" name="powercontent_url_ContentObjectAttribute_ezurl_text_pcattributeid" value="" />


        <input class="box" type="text" size="70" name="powercontent_subject_ContentObjectAttribute_ezstring_data_text_pcattributeid" value="" />


     </div>


 

     <div class="block">


       <label>Message (required)</label><div class="labelbreak"></div>


       <textarea class="box" cols="70" rows="10" name="powercontent_message_ContentObjectAttribute_data_text_pcattributeid"></textarea>


    </div>


    <div class="buttonblock">


       <input class="button" type="submit" name="CreateButton" value="Comment" />


    </div>


  </form>


</div>


<!-- END POWERCONTENT CODE -->




I use the default comment class (ID=13).

Thanks for your help

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Up

Simon Boyer

Member since:
09 March 2011

Posts: 49

Friday 04 November 2011 11:50:27 am

Hi Pascal,

View this topic : "Empty fields when submit form, and no error message"
http://projects.ez.no/powerconten...hen_submit_form_and_no_error_message

--
Simon Boyer
Developer at Open Wide

Up

You need to be logged in to post messages in the forums. New users may register here.