Tabber with "Only Displaying the First Ten Words..." patch

jQuery based tabbed Product and Fragment Descriptions.
Post Reply
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Tabber with "Only Displaying the First Ten Words..." patch

Post by norman »

To omit the {TAB NAME} stuff inadvertently showing when using the Advanced Guide Only Displaying the First Ten Words... on things like New Product, Best Sellers, etc - use this instead of the Advanced Guide code:

Code: Select all

<actinic:block php="true" >
$sShort = "";
$nCount = 0;
$sOriginal = '<actinic:variable encoding="perl" name="ProductDescription" selectable="false" />';
$newstring = preg_replace('/(\{|&#123;)(.*?)(&#125;|\})/s', '<br>', $sOriginal);

foreach(explode(" ", $newstring) as $sWord)
    {
   if ($nCount > 10)
    {
    $sShort .= "...";
    break;
    }
   $sShort .= $sWord . " ";
   $nCount++;
   }
echo $sShort;
</actinic:block>
This puts a <br> tag where every tab header would have been so each tab content appears on a new line.
Norman
Post Reply