1 robrockley May 27, 2007 17:25
3 edb May 31, 2007 08:51
One little problem: $cut doesn't count if $format isn't 'xml'. See http://doc.b2evolution.net/v-1-9/__filesource/fsource_evocore__blogsincMODELitems_item.class.php.html#a1220 and http://doc.b2evolution.net/v-1-10/__filesource/fsource_evocore__blogsincMODELitems_item.class.php.html#a1221 for the line of code that shows this to be the situation. I do not know what will happen if you make the format be xml. Probably won't show images or have links be links?
robrockley what do you mean by "on the link blog page"? You can get rid of the text that shows up for both "read more" and whatever it says on the permalink page, but first it'll help to know what you're asking about. Got a link where we can see what you don't want?
4 balupton May 31, 2007 13:58
Hrmm, ok, then i have no clue.
5 robrockley Jun 01, 2007 00:05
Thank you both (Balupton and EdB) for your feedback. I have a multiuser blog. What I'd like to do is display the first 150 words of each post on the 'Blog All' page but display the full (non-truncated) post on the user's blog page as it would normally appear. I'd like to display an ellipsis (...) after the first 150 words.
I did look at the technical documention for the content() and get_content() functions. If $format is passed as 'xml' to the content() function, the post text does get get off at whatever value is specified for $cut.
I'm presuming that the code within the get_content() function that does this when $format = 'xml' is the following:
if( ($format == 'xml') && $cut )
{ // Let's cut this down...
$blah = explode(' ', $output);
if (count($blah) > $cut)
{
$excerpt = '';
for ($i=0; $i<$cut; $i++)
{
$excerpt .= $blah[$i].' ';
}
$output = $excerpt.'...';
}
}
If I changed that to:
if( ($format == 'xml' || $format == 'htmlbody') && $cut )
and set $cut to 150 on the Blog All _main.php file then perhaps this would accomplish my goal. I guess there's one one way to find out ;)
6 edb Jun 01, 2007 01:48
Yup. The thing is if word 150 is the src part of an img tag or the href part of a link it'll be worse than a dangling participle. Whatever that is. Meaning I don't think it'll finish the tag meaning it'll be b-a-d for your visitors.
But if you try it you'll be the expert on what happens!
7 balupton Jun 01, 2007 07:06
The best bet would just be to output unformatted plain text, and if that still outputs the '
' etc then do a regex or something to remove those.I would have another crack at it maybe tomorrow or sunday.
Replace
in your skins main.php file with