Hi there,
I'm developing a site for a client at the moment who have long product names. I've tried to be clever and use the advanced user guide instructions to try and display the first 6 words of the search result product name however the PHP isn't recognised and the full name appears. I have the following code within my search result template:
Do I have to add anything else in order for this PHP to kick in?
Any help is, as always, greatly appreciated.
I'm developing a site for a client at the moment who have long product names. I've tried to be clever and use the advanced user guide instructions to try and display the first 6 words of the search result product name however the PHP isn't recognised and the full name appears. I have the following code within my search result template:
Code:
<actinic:block if="%3cactinic%3avariable%20name%3d%22SearchResultShowsName%22%20%2f%3e"> <h3 class="product-name"><script type="text/template"><Actinic:Variable Name="SearchResultLink"/><actinic:block php="true" > $sShort = ""; $nCount = 0; $sOriginal = '<actinic:variable encoding="perl" name="SearchResultProductName" selectable="false" />'; foreach(explode(" ", $sOriginal) as $sWord) { if ($nCount > 6) { $sShort .= "..."; break; } $sShort .= $sWord . " "; $nCount++; } echo $sShort; </actinic:block></a></script></h3> </actinic:block>
Do I have to add anything else in order for this PHP to kick in?
Any help is, as always, greatly appreciated.
Comment