I am passing the_excerpt_rss() as a Flash parameter on an external page (the loop is working fine), but my code will not work with the newline at the beginning. I have tried using str_replace(), trim(), ltrim() and it simply won't remove the unwanted line break.
<?php
define('WP_USE_THEMES', false);
require('./blog/wp-blog-header.php');
?>
// code within swfobject
flashvars = {<?php $args1 = array('cat=1'); query_posts($args1);
$posts = get_posts('numberposts=1&cat=1');
foreach ($posts as $post) : start_wp(); ?>
permalink:"<?php the_permalink(); ?>",
title:"<?php the_title(); ?>",
excerpt:"<?= ltrim(the_excerpt_rss(),'\n,\r'); ?>"
<?php endforeach; ?>}
Outputs:
flashvars = {
permalink:"http://marcysutton.com/blog/?p=1",
title:"The next big thing.",
excerpt:"
So this is my new blog. You may or may not have noticed it is connected to my photo gallery via the links below my logo: I wanted to make it easy to navigate around the backside of my website. Think of this collection as a reverse mullet — party in the front and business [...]"}
The line break after excerpt:" is causing an error in my javascript code. The flashvars work fine when I remove that variable, so I know that is causing the error. Any suggestions?