Truncate?
Permalink Browser Info Environment
Is there a way to include a field in the template that is truncated? For instance, if I have a description field and I want the full field to appear in the details page, but only the first 300 characters or so to appear in the list page. Is there a way to get part of the contents of that field?
Thanks
Thanks
Type: | Discussion |
---|---|
Status: | New |
So simple, thanks!
Hi there -
If I am trying to truncate the length of a description in the page list I currently have:
<?php
if(!$controller->truncateSummaries){
echo $cobj->getCollectionDescription();
}else{
echo $textHelper->shorten($cobj->getCollectionDescription(),$controller->truncateWords);
}
?>
This then uses the controller set in the page list block to control the number of Characters after which it is truncated. How can I change this to be words, as currently it just cuts off words in the middle and I need to change ti to complete a word before cutting.
Any ideas? (I have looked in the c5 api docs I could find but cant see how I would do this)
Cheers
If I am trying to truncate the length of a description in the page list I currently have:
<?php
if(!$controller->truncateSummaries){
echo $cobj->getCollectionDescription();
}else{
echo $textHelper->shorten($cobj->getCollectionDescription(),$controller->truncateWords);
}
?>
This then uses the controller set in the page list block to control the number of Characters after which it is truncated. How can I change this to be words, as currently it just cuts off words in the middle and I need to change ti to complete a word before cutting.
Any ideas? (I have looked in the c5 api docs I could find but cant see how I would do this)
Cheers
I don't know...I'm using a custom function to do this within Data Display. I'm not sure how C5's helper function works.
Or you can specify how many words, using: