Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Word Limit In Page Comments? Rate Topic   - - - - -

 
  • astrocas
  • Newbie
  • Members
  • Join Date: 21-Feb 13
  • 9 posts

Posted 29 April 2014 - 04:06 AM #1

Hi Guys,

I am trying to put together a "25 words or less" style contest. Does anybody know a way to edit the length of words permitted in a page comment, so that people cannot go over 25 words?

Kind Regards!

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21741 posts

Posted 29 April 2014 - 10:44 AM #2

I am trying to put together a "25 words or less" style contest. Does anybody know a way to edit the length of words permitted in a page comment, so that people cannot go over 25 words?

Kind Regards!


Unfortunately there is no way to set limit by words without additional customization. But you can use the "maxlength" HTML attribute which specifies the maximum number of characters allowed in the field.
GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • Alt-team
  • CS-Cart Developer
  • Authorized Reseller
  • Join Date: 18-Jan 11
  • 2822 posts

Posted 29 April 2014 - 11:37 AM #3

Hi Guys,

I am trying to put together a "25 words or less" style contest. Does anybody know a way to edit the length of words permitted in a page comment, so that people cannot go over 25 words?

Kind Regards!


Hello astrocas,

As eComLabs suggests the easiest way is to limit the number of characters in page comments.
You can do it as follows (CS-Cart 4):

Open the file design/themes/basic/templates/addons/discussion/views/discussion/components/new_post.tpl

Find the line:

<textarea id="dsc_message_{$obj_prefix}{$obj_id}" name="post_data[message]" class="input-textarea" rows="5" cols="72">{$discussion.post_data.message}</textarea>

and change it like shown below:

<textarea {if $runtime.controller=="pages"}maxlength="200"{/if} id="dsc_message_{$obj_prefix}{$obj_id}" name="post_data[message]" class="input-textarea" rows="5" cols="72">{$discussion.post_data.message}</textarea>

Thus, we've added
{if $runtime.controller=="pages"}maxlength="200"{/if}
. It means that the number of charaters to input in a page comment will be limited to 200 characters.

Save the file and don't forget to clear admin cache to see the changes.

Best regards, Alt-team

ADD-ONS  Web development service  | CS-Cart dedicated developers

Buy MULTIVENDOR - USD 1250 (14% off)   Buy CS-CART LICENCE - USD 345 (13% off)

 Email - manager@alt-team.com | Skype - Altteam    


 
  • astrocas
  • Newbie
  • Members
  • Join Date: 21-Feb 13
  • 9 posts

Posted 01 May 2014 - 04:11 AM #4

Thanks very much guys!

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21741 posts

Posted 02 May 2014 - 07:21 AM #5

Thanks very much guys!


You are welcome!
GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)