1 keatonatron Mar 20, 2007 17:30
3 keatonatron Mar 21, 2007 11:48
Thanks for the reply.
What do you mean about XML type? Where is that specified?
I tried both:
$Item->content( '#', '#', 'More', '#', '#', '#', 'htmlbody', 10);
and
$Item->content( '#', '#', 'More', '#', '#', '#', 'htmlbody', '10');
and I get no errors, but it doesn't truncate anything.
4 afwas Mar 21, 2007 11:57
I read this at the manual:
void content( [mixed $disppage = '#'], [mixed $dispmore = '#'],
[string $more_link_text = '#'], [string $more_anchor = '#'],
[string $before_more = '#'], [string $after_more = '#'],
[string $format = 'htmlbody'], [integer $cut = 0],
[boolean $stripteaser = false], [string $more_file = ''] )
as:
$Item->content( '#', '#', '#', '#', '#', '#', 'htmlbody', 10);
.
The integer (10) should not be between brackets ('').
5 keatonatron Mar 21, 2007 13:21
I see. Too bad :( I'm making a skin for mobile devices, where screen space is limited ;)
6 afwas Mar 21, 2007 14:05
blueyed wrote:
Please note that you have to pass all params before $cut with their default value and that $cut only works for "xml" type..
I have read this as: it doesn't work in posts (they are not stored as xml) but I may be wrong. You mention that you want to display the blog on a mobile device. that opens a new possibility: you can write a blog with only the rss as skin. This skin could be truncated the way you wanted to. It's even possible to force a css specially for mobile devices.
I had this question: why do you want the complete array to get to the cut part. Doesn't this line:
$Item->$cut(10);
work?
7 blueyed Mar 21, 2007 19:58
You are using format "htmlbody" in your code above. That's what has to be "xml" for cut() to work.
$Item->$cut(10); won't work.. unless $cut is set to a method name that exists in the Item class.
Just look at the source of the content method, if you only want to use that functionality. There may even be better PHP examples for something like "first x words" out there.
Instead of using the content() method, you could also use the $content property ($Item->content), which holds the raw content (but maybe not processed by renderer plugins).
See http://doc.b2evolution.net/v-1-9/evocore/Item.html#methodcontent
Please note that you have to pass all params before $cut with their default value and that $cut only works for "xml" type..