I am using a php ellipsis to shorten product descriptions in the product summary and end with ...
Setting the encoding of Product Description to strip HTML deals with html code but if the description contains "some quoted text" in quote marks it generates a parser error.
Can any php wizards help? BTW, I am using php as it is a very javascript heavy site and I am wary of conflicts.
Example:
This product description is OK
with this elli[psis php code:
However, putting some quotes round some of the words in the description ("consectetur adipiscing elit, sed do eiusmod tempor incididunt") stops it working producing a parser error:
There are thousands of products all with coded content so change is not an option.
I would be so grateful to be pointed in the right direction.
Thank you
Setting the encoding of Product Description to strip HTML deals with html code but if the description contains "some quoted text" in quote marks it generates a parser error.
Can any php wizards help? BTW, I am using php as it is a very javascript heavy site and I am wary of conflicts.
Example:
This product description is OK
!!<Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. <br><b>size: </b>200ml>!!
!!<<a href="http://www.domainname.co.uk/acatalog/link.html#B"><img src="some-image-120.jpg" width="120" height="60"></a>>!!
!!<<a href="http://www.domainname.co.uk/acatalog/link.html#B"><img src="some-image-120.jpg" width="120" height="60"></a>>!!
Code:
<actinic:block php="true" > $string = "<actinic:variable encoding="strip" name="ProductDescription" />"; $length = 190; if (strlen($string) > $length) { //limit hit! $string = substr($string,0,($length -3)); //stop on a word. $string = substr($string,0,strrpos($string,' ')).'...'; echo $string; } </actinic:block>
!!<Lorem ipsum dolor sit amet, "consectetur adipiscing elit, sed do eiusmod tempor incididunt" ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. <br><b>size: </b>200ml>!!
!!<<a href="http://www.domainname.co.uk/acatalog/link.html#B"><img src="some-image-120.jpg" width="120" height="60"></a>>!!
!!<<a href="http://www.domainname.co.uk/acatalog/link.html#B"><img src="some-image-120.jpg" width="120" height="60"></a>>!!
I would be so grateful to be pointed in the right direction.
Thank you
Comment