I am using an rss to html script to convert my RSS feed to HTML on a web page and it has a post processing feature that will do “anything” I am trying to have it search the content of the RSS and look for the keyword “airlines” and when it finds it change it to <b>airlines</b> basically add a bold tag to it. This is the example for modifying img tags but after reading the link to preg_match_all and searching google I am only more confused. I am hoping it is a quick modification for someone here.
<?php
// We MUST keep this classname.
class SimplePie_PostProcess
{
// Function name MUST be the same as the template tag we're processing, all lowercase, and MUST accept a single string parameter.
function item_content($s)
{
// Match all images in the content.
preg_match_all('/<img([^>]*)>/i', $s, $matches);
// Clear out the variable.
$s = '';
// Loop through all of the *complete* matches (stored in $matches[0]).
foreach ($matches[0] as $match)
{
// Add the images (only) back to $s.
$s .= $match . '<br />';
}
// Return $s back out to the plugin.
return $s;
}
}
?>