I've tweaked the template.php in my theme so that every rss post has a constant title: The Browser. The line looks like this:

$output .= " <title>The Browser</title>\n";

But now I find that the feed won't validate, apparently because no link is being outputted for that title. Here's the line that produces the link (I think). How would I rewrite it so that it always links the post title to "http://thebrowser.com" ?

$output .= ' <link>'. check_url($link) ."</link>\n";

Comments

mshmsh5000’s picture

Can you post the full RSS output? Are you sure that you've correctly defined $link before you get to the second quoted line?

Matt Holford

robertcottrell’s picture

Thanks. Trouble is, I don't know how much I don't know here. I stripped in the line of code that zbricoleur very kindly offered, but thereby crashed the site. Here's the function

function my_format_rss_item($title, $link, $description, $args = array()) {
 $output = "<item>\n";
 $output .= " <title>The Browser</title>\n";
 $output .= ' <link>'. check_url($link) ."</link>\n";
 $output .= ' <description>'. check_plain($description)
."</description>\n";
 $output .= format_xml_elements($args);
 $output .= "</item>\n";

 return $output;
}
mshmsh5000’s picture

If you took zbricoleur's code verbatim, your problem is likely due to the single quote at the beginning of the string and double quote at the end.

Try

$output .= " <link>http://thebrowser.com</link>\n";

And see if the output is valid. If so, you may not be passing my_format_rss_item() the correct $link value in the first place.

Matt Holford

zbricoleur’s picture

$output .= ' <link>http://thebrowser.com</link>\n";