Announcement

Collapse
No announcement yet.

product description on section page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    product description on section page

    hi all,

    I'm using this script to populate certain amount of words from product description into section if you understand what i mean, however it populates all the characters inc. !!<>!!

    so the question is: is there any possibility to modify the script so it only populates letters not symbols?

    script i'm using:
    Code:
    $sShort = "";
    $nCount = 0;
    $sOriginal = '<actinic:variable encoding="perl" name="ProductDescription" selectable="false" />'; 
    foreach(explode(" ", $sOriginal) as $sWord)
    	{
       if ($nCount > 20)
       	{
       	$sShort .= "...";
       	break;
       	}
       $sShort .= $sWord . " ";
       $nCount++;
       }
    echo $sShort;
    thank you very much

    #2
    Originally posted by vistamaster View Post

    so the question is: is there any possibility to modify the script so it only populates letters not symbols?
    lots of ways using the string functions in javascript, you could use two calls to string.replace to replace the offending characters, or you could set up a 'for' loop to get each character, check it and only add it to the result if it passes certain tests.

    Malcolm

    SellerDeck Accredited Partner,
    SellerDeck 2016 Extensions, and
    Custom Packages

    Comment


      #3
      Right click on the ProductDecription variable and play around with the type of PHP ... there are several including something like Strip HTML (not at an Actinic machine to check) and that removes embedded crumph.


      Bikster
      SellerDeck Designs and Responsive Themes

      Comment


        #4
        Originally posted by jont View Post
        Right click on the ProductDecription variable and play around with the type of PHP ... there are several including something like Strip HTML (not at an Actinic machine to check) and that removes embedded crumph.
        Thanks for your reply Jont, if I choose Strip HTML then I would have to add .<br/>'s to all the product descriptions, which would take alot of time to sort them out.

        I'm not into javascript at all, could you help me out with it please?

        Comment


          #5
          I think what you are after has already been done. Have a search around on the forum.

          These are some of the links I found (there are many more) that may help you:
          http://community.actinic.com/showthread.php?p=294377
          http://community.actinic.com/showthread.php?t=34846

          Try this search or similar: $sShort strip html site:community.actinic.com

          Comment


            #6
            yes, and it is here: http://community.actinic.com/showthr...iption+section

            thank you for your time guys.

            Comment


              #7
              Originally posted by jont View Post
              crumph.
              Crap and gumph?

              Comment


                #8
                Exactly


                Bikster
                SellerDeck Designs and Responsive Themes

                Comment

                Working...
                X