hey all..
i ve a question.. is there a feature or a plugin, which enables me to "cut down" an blog entry after (for example) 300 chars? and a "<read more...>" will be instertet. i think this would make the overview cleaner...
thanks in advance
michu
ps an example
-----------------
Article 1:
blah blah blah blah
blah blah blah blah
blah blah <read more...>
Article 2:
blah blah blah blah
blah blah blah blah
blah blah <read more...>
-----------------
read more
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: read more
Yes, this comes bydefault with serendipity.That's why our distinction "Entry Body" and "Extended Body" isthere.
Regards,
Garvin
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
The extended entries is the way to go. It allows you to enter only what you want in the overview as the article body, then the rest of the article in the extended body.
If you really want to truncate articles, you'd need to edit your template. In entries.tpl, find
and change it to
That's set up from the Smarty site http://smarty.php.net/manual/en/languag ... uncate.php, so it ought to work, but when I tried it on my site, I got weird lengths for the truncation.
Maybe I'd better look into upgrading or something. I use the extended entry feature, though.
Good Luck!
Judebert
If you really want to truncate articles, you'd need to edit your template. In entries.tpl, find
Code: Select all
<div class="serendipity_entry_body">
{$entry.body}
</div>
Code: Select all
<div class="serendipity_entry_body">
{if $is_single_entry}
{$entry.body}
{else}
{$entry.body|truncate:300:"<a href='`$entry.link`'>...Read More</a>":false}
{/if}
</div>
Maybe I'd better look into upgrading or something. I use the extended entry feature, though.
Good Luck!
Judebert
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
ROTFL.Dang. Ijust wrote something like that in german 
See, that happens when people crosspost
Regards,
Garvin
See, that happens when people crosspost
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
I've been playing with truncate as well, and I can't figure out why it doesn't actually truncate at the number of characters I specify, for example I might say 50 characters and it seems to randomise this from 39 to 70 characters. Any ideas?
Also, in response to the previous post, be careful about truncating posts in overview mode because the code judebert provided doesn't separate html from text, so if you have an image before entry text, it will truncate somewhere, who knows where, and could totally wreck what you're trying to achieve. Definitely use the extended body instead of smarty script!
I've added a read more to the andreas08 theme I'm working on, which I hope to release soon, but really need to finish my themes checklist and update all themes before I go releasing more new themes. If anyone reads this before I release the theme, either pm me or comment on my blog and I'll send you the instructions to make this work.
Carl
Also, in response to the previous post, be careful about truncating posts in overview mode because the code judebert provided doesn't separate html from text, so if you have an image before entry text, it will truncate somewhere, who knows where, and could totally wreck what you're trying to achieve. Definitely use the extended body instead of smarty script!
I've added a read more to the andreas08 theme I'm working on, which I hope to release soon, but really need to finish my themes checklist and update all themes before I go releasing more new themes. If anyone reads this before I release the theme, either pm me or comment on my blog and I'll send you the instructions to make this work.
Carl
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi Carl!
Best regards,
Garvin
I think truncates cuts at a word boundary. You might need to look up the documentation on http://smarty.php.net/ to set another parameter that cuts at character boundaries?carl_galloway wrote:I've been playing with truncate as well, and I can't figure out why it doesn't actually truncate at the number of characters I specify, for example I might say 50 characters and it seems to randomise this from 39 to 70 characters. Any ideas?
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
mmm, thing is though, I want to use it to truncate the homelink in the banner. I've been searching out users of my themes and have discovered that quite a few actually use really long post titles, and any theme that uses the homelink could end up being badly thrown out. I thought truncate would solve the problem, and it does, just erratically. Any other thoughts?
Carl
Carl