Tabber prompts appear on New Products and Best Sellers.
Posted: Mon Jun 16, 2008 11:56 pm
If you include Tabber products in these lists then you may get a description like:
{Summary}Summary text.{Details}Detailed description{Etc}.....
Here are two ways to overcome this.
1) To get a description like:
Summary
Summary text.
Details
Detailed description
Etc
.....
We need to replace the { and } with newlines via the following.
In your New Products and Best Sellers layouts replace
with
2) To lose the tab names completely and get a description like:
Summary text.
Detailed description
.....
We replace
with
3) And here is how to combine (2) with the Advanced Guide article "Display Only First Ten Words...".
We replace
with
Note that when pasting this code into layouts, the line:
ENDOFCODE;
must not be indented in any way or you will get PHP errors.
{Summary}Summary text.{Details}Detailed description{Etc}.....
Here are two ways to overcome this.
1) To get a description like:
Summary
Summary text.
Details
Detailed description
Etc
.....
We need to replace the { and } with newlines via the following.
In your New Products and Best Sellers layouts replace
Code: Select all
<actinic:variable name="ProductDescription" />
Code: Select all
<actinic:block php="true">
$pd = <<<ENDOFCODE
<actinic:variable name="ProductDescription" />
ENDOFCODE;
$pd = str_replace('{', '<br/><b>', $pd); // replace all { with <br/> and make bold
$pd = str_replace('}', '<br/></b>', $pd); // replace all } with <br/> and end bold
echo $pd;
</actinic:block>
Summary text.
Detailed description
.....
We replace
Code: Select all
<actinic:variable name="ProductDescription" />
Code: Select all
<actinic:block php="true">
$pd = <<<ENDOFCODE
<actinic:variable name="ProductDescription" />
ENDOFCODE;
$pd = preg_replace('/{.*?}/', '<br/>', $pd); // replace all {...} with <br/>
echo $pd;
</actinic:block>
We replace
Code: Select all
<actinic:variable name="ProductDescription" />
Code: Select all
<actinic:block php="true" >
$sShort = "";
$nCount = 0;
$sOriginal = <<<ENDOFCODE
<actinic:variable name="ProductDescription" />
ENDOFCODE;
$sOriginal = preg_replace('/{.*?}/', '', $sOriginal); // remove all {...}
foreach(explode(" ", $sOriginal) as $sWord)
{
if ($nCount > 10)
{
$sShort .= "...";
break;
}
$sShort .= $sWord . " ";
$nCount++;
}
echo $sShort;
</actinic:block>
ENDOFCODE;
must not be indented in any way or you will get PHP errors.