1 super80 Dec 31, 2009 19:14
3 super80 Dec 31, 2009 22:17
Thanks sam2kb!
I managed to get str_replace to work as well, but your solution is much better.
Much appreciated :)
I have a new issue where twitter doesn't accept some updates because various titles are long and exceed the allotted character count when combined with the url.
4 sam2kb Dec 31, 2009 23:00
If you're using b2evo 3.3 you can try this
$content = strmaxlen( format_to_output( $Item->title, 'htmlattr' ).' '.$Item->get_permanent_url(), 135 );
If you are still on b2evo 2 use this
$content = substr( format_to_output( $Item->title, 'htmlattr' ).' '.$Item->get_permanent_url(), 0, 135 );
<a id="tweet" target="_blank" href="http://twitter.com/home?status=<?php echo urlencode( $content ); ?>@yourname"></a>
You can save some space for content by using short pemalinks like
yourblog.com?p=222 where 222 is post ID
e.g.
$content = strmaxlen( format_to_output( $Item->title, 'htmlattr' ).' '.url_add_param( $Blog->gen_blogurl(), 'p='.$Item->ID ), 135 );
Not tested, use at your own risk ;)
5 super80 Jan 01, 2010 14:39
Thanks again, I will test these out. (I am on b2evo 3.3.2)
You can get escaped title with
This should work