Results 1 to 14 of 14

Thread: How To Limit Keywords and Descriptions

  1. #1
    Join Date
    Jul 2007
    Posts
    46

    Default How To Limit Keywords and Descriptions

    Hi,

    Just wanted to ask whether a modification exists to limit keywords and description entires. I've seen it before, but couldn't find it again.

    Is there a recommendation from some experienced members as to what number it should be specifically limited to for both?

    Thanks!

  2. #2
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    How do you want to limit them? Do you want to limit how many characters they can put in the form or just how many are displayed?

  3. #3
    Join Date
    Jul 2007
    Posts
    46

    Default

    Just how many characters they can put in the form

  4. #4
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    You can use maxlength in the input tag to limit the number of characters to input.

    <input type="text" maxlength="maxcharacters" etc...

  5. #5
    Join Date
    Jul 2007
    Posts
    46

    Default

    Any recommendations on the number of characters for keywords and description? What do you guys use?

  6. #6
    Join Date
    Jul 2007
    Posts
    46

    Default

    sorry, I don't know how that happened

  7. #7
    Join Date
    Jul 2007
    Posts
    46

    Default

    Could someone please help me modify my code and tell me how to do so as to limit keywords and description? If you have a recommended character number for each limitation it would also be of great help

    Thanks Guys!

  8. #8
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    There is no limit, high or low.

    Assume an average word is 7 characters, and you want to allow no more than 10 keywords, so you would use maxlength=76 (7x10+6 spaces)

    description is the same, but typically larger. Perhaps a value between 150 and 250.

    To use maxlength I would suggest you go to google and search for "html form" and you'd find a site that would show you how to use maxlength and all the other fun toys you can use on a form.

    Then you would edit add_form.html and possibly upgrade.html

  9. #9
    Join Date
    May 2007
    Location
    NJ, United States
    Posts
    1,651

    Default

    Some of the other directories I've visited to submit my sites have used a max of 250 for the keywords and about 400 for the description.

    Hope that helps
    FSGDAG | IndexU Hosting | Owner
    Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
    Follow Us On Twitter | FaceBook Profile | YouTube Videos

  10. #10
    Join Date
    Jul 2007
    Posts
    46

    Default

    Thanks for the pointers guys. I'm still unsure about the following, I added maxlength, but it doesn't work

    Code:
          <label for="description">Description</label>
          <textarea id="description" name="description" cols="35" rows="10" maxlength="255" style="overflow: auto;"><%$description%></textarea>

  11. #11
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    I didn't know this one, but if you searched Google for "form maxlength textarea" you would have found out that maxlength doesn't apply to textarea.

    Perhaps take a look ar http://www.allthescripts.com/page-458642.htm for a solution

  12. #12
    Join Date
    Nov 2007
    Posts
    227

    Default

    You could use Javascript to limit the field to x-characters and show the user how many characters they have left. Check this one out.

    http://www.phpinsider.com/php/code/SmartyFormtool/demo/

  13. #13
    Join Date
    Mar 2007
    Posts
    65

    Arrow Suggestion

    Here is what I am using. Works great. I have included the whole line of code for you to get a better idea of the context. There are a lot of great answers here but sometimes they are so abbreviated and assumptive of knowledge level that it takes me a while to figure out the "what", "where" and "how" of the answer.

    This code is in rows.html which is in the themes folder in the theme you are using.

    <strong>Description :</strong> <%$description|truncate:300%>&nbsp;&nbsp;&nbsp;<a href="<%$site_url%>/<%$detail_page_url%>">[more...]</a> <br>

    The number in blue is the number of characters.

    I used the word and character count function in the Tools bar of MS Word to determine the optimum size.

    Did this help you? If so, please link to one of these sites!

    http://www.bigfreeguide.com/camping/ or http://www.geogolfcourse.co.uk or http://www.places2b.co.ukor http://www.theleisureguide.co.uk or http://www.time-waster.co.uk or http://www.touristdetective.co.uk or http://www.camplinks.co.uk or http://www.afterdirectory.com OR, Add all of them to your general directory!!

  14. #14
    Join Date
    Nov 2007
    Posts
    227

    Default

    I have implemented the above javascript into my add link form. It is very simple and gives the users a visual on how many characters they can use and how many characters they have left. You can see it in action at http://www.scriptdragon.com/add.php. You can log in with
    Username: test
    Password: test

    Here is how I did it.

    Open themes/yourtheme/add_form.html and find this section (Note: I am using the portaldex theme for this example, so your code may bbe slightly different depending on your theme.):

    Code:
        <script language="javascript" type="text/javascript" src="<%$tpl_base%>/calendar.js"></script>
        <script language="javascript" type="text/javascript" src="<%$tpl_base%>/calendar-en.js"></script>
        <script language="javascript" type="text/javascript" src="<%$tpl_base%>/calendar-setup.js"></script>
        <script language="javascript" type="text/javascript" src="<%$tpl_base%>/json.js"></script>
        <script language="javascript" type="text/javascript" src="<%$tpl_base%>/ajax.js"></script>
    and add this directly after it

    Code:
        <script language="javascript" type="text/javascript" src="<%$tpl_base%>/formtool.js"></script>
    Now scroll a few lines down and find this (or similar):

    Code:
          <label for="description">Description</label>
          <textarea id="description" name="description" cols="35" rows="10" style="overflow: auto;"><%$description%></textarea>
    and make it look similar to this:

    Code:
          <label for="description">Description</label>
          <textarea id="description" name="description" cols="35" rows="10" style="overflow: auto;" onkeyup="javascript:formtool_count_chars(this.form.elements['description'],this.form.elements['description_limit'],500,true)"><%$description%></textarea>
          <div class="inline">
          Limit: <input type="text" name="description_limit" size="3" readonly="readonly" value="500" /> Characters
          </div>
    In the above code change the number 500 (in both locations) to match the maximum characters you want to allow in the field.

    No go to http://www.phpinsider.com/php/code/SmartyFormtool/ and download the script and extract it. Upload the javascript file and the edited add_form.html file into the same directory. You are done.

    This should only take about 5 minutes to complete. Good luck.

Similar Threads

  1. Replies: 5
    Last Post: 07-25-2007, 08:04 AM
  2. How to limit NEW/Modified listings limit on front page
    By lewisw in forum Blocks and Modification
    Replies: 3
    Last Post: 07-19-2006, 01:23 AM
  3. Cat descriptions do not appears
    By ime in forum v5.x
    Replies: 2
    Last Post: 05-25-2006, 08:08 AM
  4. Limit keywords & description
    By kooks in forum v5.x
    Replies: 3
    Last Post: 04-28-2003, 02:56 AM
  5. Limit of 150
    By sussigustis in forum Indexu Lite
    Replies: 2
    Last Post: 09-13-2002, 02:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •