Page 1 of 1

[SOLVED] CGFeedback textarea -- display line returns?

Posted: Fri Dec 06, 2013 3:06 pm
by twwitt
Hi -- I'm using CGFeedback 1.511. with CMSMS 1.11.4.

My client would like carriage returns within the Text Area response to be displayed when the comment is posted. (Currently, even if a responder makes a hard return, the comment appears as one long paragraph). Maybe this has to do with how all Text Areas behave?

Can somebody give me a clue as to how to enable paragraph returns in this module?

Thanks in advance.

Re: CGFeedback textarea -- possible to display line returns?

Posted: Fri Dec 06, 2013 5:14 pm
by Rolf

Re: CGFeedback textarea -- possible to display line returns?

Posted: Mon Dec 09, 2013 8:20 pm
by twwitt
Thanks for responding. I'm not 100% sure in a Feedback template to put the |nl2br modifier (in the Summary Template in {$one.data}??)

But the problem seems that ALL of the formatting (hard returns, soft returns, etc,) is stripped out of the responses typed in the text area. Would this solution correct this?

Re: CGFeedback textarea -- possible to display line returns?

Posted: Mon Dec 09, 2013 8:57 pm
by Wishbone
twwitt wrote:Thanks for responding. I'm not 100% sure in a Feedback template to put the |nl2br modifier (in the Summary Template in {$one.data}??)
Whatever variable displays the text, put |nl2br after it.

Example: {$myvar.text|nl2br}

Re: CGFeedback textarea -- possible to display line returns?

Posted: Mon Dec 09, 2013 10:14 pm
by twwitt
Thanks. I believe the change should be {$one.data|nl2br} if I'm reading the Summary Template correctly (see full template below). However, changing this has no effect on keeping line returns.

What does have an effect on keeping line returns in comment responses is this:

In CGFeedback settings, if I choose NO for "Allow use of the wysiwyg editor for comments?" (formerly, it was YES -- even though a wysiwyg editor does not appear on the website for the commenter to use, only in the admin for the administrator to use-- is this the intended result for saying yes to this selection?) and if I choose YES for "Allow commenter to include html in comments", then the formatting is correctly retained, though the wysiwyg disappears from the admin Edit Comments page (I assume this is the intended result?).

It's recommended in the Module to not enable the wysiwyg editor at the same time as allowing the commentor to include html in comments.

So, is this my solution, then? "Allow commentor to include html in comments" but then to disable the wysiwyg editor in the admin?

Summary template below:

Code: Select all

{* summary template *}
<div id="cgfeedback_report">
<div id="{$actionid}_feedback_summary_report">
{strip}
{if $pagecount > 1}
<p>
  {if $pagenum > 1}
    <a href="{$firstpage_url}" title="{$mod->Lang('lbl_goto_firstpage')}"><<</a> 
    <a href="{$prevpage_url}" title="{$mod->Lang('lbl_goto_prevpage')}"><</a> 
  {/if}
  {$mod->Lang('lbl_page')} {$pagenum} {$mod->Lang('lbl_of')} {$pagecount}
  {if $pagenum < $pagecount}
     <a href="{$nextpage_url}" title="{$mod->Lang('lbl_goto_nextpage')}">></a> 
    <a href="{$lastpage_url}" title="{$mod->Lang('lbl_goto_lastpage')}">>></a>
  {/if}
</p>
{* pagecount *}{/if}

{if isset($comments)}
{foreach from=$comments item='one'}
<div class="feedback_summary_item">
    <div class="feedback_item_title">
  <strong>    <a href="{$one.detail_url}" title="{$one.title}">{$one.title}</a></strong>
    </div>

 <div class="feedback_item_authorname">
  Date: {$one.created|cms_date_format}
    </div>

  {*  <div class="feedback_item_rating">
      {$mod->Lang('lbl_rating')}: {$one.rating}  
      {section name='rating' start=1 loop=6}
        {if $smarty.section.rating.index <= $one.rating}
          <img src="{$rating_imgs.img_on}" alt=""/>
        {else}
          <img src="{$rating_imgs.img_off}" alt=""/>
        {/if}
      {/section}
    </div>*}

    {if $one.author_name}
    <div class="feedback_item_authorname">
      {$mod->Lang('lbl_author_name')}: {$one.author_name}
    </div>
    {/if}

 {if $one.author_email}
    <div class="feedback_item_authoremail">
      {$mod->Lang('lbl_author_email')}: {$one.author_email}
    </div>
    {/if}

  {*  {if $one.author_ip}
    <div class="feedback_item_authorip">
      {$mod->Lang('lbl_author_ip')}: {$one.author_ip}
    </div>
    {/if} *}

    <div class="feedback_item_data">
       {$one.data|nl2br}
    </div>



    {if isset($one.fields)}    
      {foreach from=$one.fields key='name' item='field'}
      <div class="feedback_item_field">
        {$name}: {$field.value}
      </div>
      {/foreach}
    {/if}

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



{/foreach}
{* comments *}{/if}
{* feedback_summary_report *}</div>
{/strip}

Re: CGFeedback textarea -- possible to display line returns?

Posted: Tue Dec 10, 2013 12:00 am
by Wishbone
Can you point me to a URL with feedback?

|nl2br should do it.. It takes new lines and replaces them with <br/> .. I wouldn't give users HTML editing ability.

Re: CGFeedback textarea -- possible to display line returns?

Posted: Wed Dec 11, 2013 2:15 am
by twwitt
Can you point me to a URL with feedback?
Here's URL: http://scsynod.com/index.php?mact=CGBlo ... eturnid=86

Note: The posts are in reverse order (it's what the client wanted)...the client has manually inserted hard returns from within the Feedback admin for all of the posts except for the last one at the bottom of the page -- I left that one as it appears as it normally would.

Re: CGFeedback textarea -- possible to display line returns?

Posted: Wed Dec 11, 2013 4:40 am
by Wishbone
Works for me.. I installed CGFeedback on a hidden page on one of my sites:

http://thecastironcompanion.ca/twwitt

You can add a comment if you like.

In the summary template, I show a before |nlbr and after, so you can see the difference. If you 'view source' you can see the new lines in the one without, but doesn't have the <br/>

Excerpt of summary template:

Code: Select all

<strong>With |nl2br:</strong><br/>
         {$one.data|nl2br}
<br/><br/>
<strong>Without |nl2br:</strong><br/>
         {$one.data}
CMSMS: 1.11.9
CGFeedback: 1.6.2

Re: CGFeedback textarea -- possible to display line returns?

Posted: Thu Dec 12, 2013 5:01 am
by twwitt
Weird...I now have the latest version of CGFeedbacka installed (thought that was the problem), and have {$one.data|nl2br} in the summary template, but still doesn't display properly...Oh well.

One more question: did you enable Allow use of the wysiwyg editor for comments? in the CGFeeback setting? I have that enabled...but if I disable it (which I don't prefer), and then choose yes for Allow commentor to include html in comments then the results display properly with line returns. Can't figure out why this would be true.

Guess I'll go with that solution, though it doesn't seem quite right.

Thanks for spending all the time trying to help me out!

Re: CGFeedback textarea -- possible to display line returns?

Posted: Thu Dec 12, 2013 7:21 am
by Wishbone
twwitt wrote:Weird...I now have the latest version of CGFeedbacka installed (thought that was the problem), and have {$one.data|nl2br} in the summary template, but still doesn't display properly...Oh well.

One more question: did you enable Allow use of the wysiwyg editor for comments? in the CGFeeback setting? I have that enabled...but if I disable it (which I don't prefer), and then choose yes for Allow commentor to include html in comments then the results display properly with line returns. Can't figure out why this would be true.

Guess I'll go with that solution, though it doesn't seem quite right.

Thanks for spending all the time trying to help me out!
That is weird.. No I don't have any HTML option on.

Re: CGFeedback textarea -- possible to display line returns?

Posted: Mon Dec 16, 2013 11:42 pm
by twwitt
Well, regardless, I'm going to mark this as SOLVED, since I believe you do have the correct solution...Just something screwy going on for me.

Thanks for spending all of the time helping...