Page 1 of 1
Limit characters in summary News module
Posted: Tue Dec 26, 2006 11:13 am
by tynmar
Hi !
I'd like to limit at 50 characters for each news with a link [more] in the end.
I think it's a smarty script to put in the template but I can't find it on smarty site.
for example :
Code: Select all
{if $entry->summary}
{if $entry->formatpostdate}{$entry->formatpostdate}{/if}
{eval var=$entry->summary limitcharacters='50'}
[{$entry->morelink}]
{/if}
I don't want to add a new param
'limitcharacters' to news module if it's not necessary. I want to use a smarty function.
Is this possible ?
Thanks a lot
Re: Limit characters in summary News module
Posted: Tue Dec 26, 2006 12:01 pm
by Dee
Use Smarty's
truncate modifier in the template:
There's also a Smarty summarize function included in CMSMS (plugins/function.summarize.php) which enables you to limit the number of words.
Regards,
D
Re: Limit characters in summary News module
Posted: Tue Dec 26, 2006 12:35 pm
by Dee
Dee wrote:
There's also a Smarty summarize function included in CMSMS (plugins/function.summarize.php) which enables you to limit the number of words.
To make it work, rename the file from function.summarize.php to modifier.summarize.php.
You can then use
to trim to 10 words.
I
renamed the file in SVN so this won't be necessary in a next release.
Re: Limit characters in summary News module
Posted: Tue Dec 26, 2006 4:09 pm
by tynmar
Great !
truncate is exactly what I need.
Thanks
Re: Limit characters in summary News module
Posted: Tue Feb 17, 2009 3:59 pm
by schug.trent
I know this is an old topic, but can't find anything else on it. I have latest version of CMSMS and News Module
I tried the above methods to limited the number of words / characters that show up in a news summary, but neither seem to work.
Any other ideas?
Tried this and nothing:
Code: Select all
{if $entry->summary|summarize:10}
<div id="summary">
{eval var=$entry->summary}
</div>
<div id="moreLink">
<<<{$entry->morelink}>>>
</div>
{/if}
Tried this and nothing:
Code: Select all
{if $entry->summary|truncate:50}
<div id="summary">
{eval var=$entry->summary}
</div>
<div id="moreLink">
<<<{$entry->morelink}>>>
</div>
{/if}
Re: Limit characters in summary News module
Posted: Tue Feb 17, 2009 5:24 pm
by Nullig
I believe you need to change it to:
{if $entry->summary}
{eval var=$entry->summary|truncate:50}
morelink}>>>
{/if}
Nullig
[SOLVED]Re: Limit characters in summary News module
Posted: Tue Feb 17, 2009 5:32 pm
by schug.trent
Thanks, worked perfect!
Re: Limit characters in summary News module
Posted: Thu Dec 08, 2011 8:11 pm
by Gumir
Hi All
It took several centuries

2011
I know this is an very very old topic, but can't find anything else on it.
I try on 1.10.2 "Case Pilote" this test... but nothing...
various manipulations of the proposed methods - null result
yes... i found and see in folders
(root)/plugins/modifier.summarize.php
(root)/lib/smarty/plugins/modifier.truncate.php
rtfm this page -
http://www.smarty.net/docsv2/en/languag ... runcate/// and more...
for testing placed and here - {if $entry->summary} and here {eval var=$entry->summary} and more sado-mazo
syntax error: invalid attribute name: '|truncate:200' (Smarty_Compiler.class.php, line 1550)
syntax error: invalid attribute name: '|summarize:200' (Smarty_Compiler.class.php, line 1550)
_____
after many attempts to find and asking for your help...
How to solve this trouble now?
Any help would be greatly appreciated.. thnx
*I'm newbie to CMSMS (a few days testing ) but not noob in CMS's