Jump to content

saltem8

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by saltem8

  1. would anyone be able to tell me how I can limit this script to only pulling in 1 instead of the 10 it currently pulls in, thanks <?php // ###################################################### // ## configuration // ## // ## $rss_file= 'http://www.vbulletin.com/forum/external.php?type=rss'; // ## Adjust this variable to point to your RSS feed $rss_file = 'http://mysite.com/external.php'; // ## configuration end // ###################################################### // ## Do not touch code below! $is_item = false; $tag = ''; $title = ''; $description = ''; $link = ''; function character_data($parser, $data) { global $is_item, $tag, $title, $description, $link; if ($is_item) { switch ($tag) { case "TITLE": $title .= $data; break; case "DESCRIPTION": $description .= $data; break; case "LINK": $link .= $data; break; } } } function begin_element($parser, $name) { global $is_item, $tag; if ($is_item) { $tag = $name; } else if ($name == "ITEM") { $is_item = true; } } function end_element($parser, $name) { global $is_item, $title, $description, $link, $rss_output; if ($name == "ITEM") { $rss_output .= "<dt><strong><a href='" . trim($link) . "'>" . htmlspecialchars(trim($title)) . "</a></strong></dt><dd>" . htmlspecialchars(trim($description)) . "</dd>"; $title = ""; $description = ""; $link = ""; $is_item = false; } } $parser = xml_parser_create(); xml_set_element_handler($parser, "begin_element", "end_element"); xml_set_character_data_handler($parser, "character_data"); $fp = fopen($rss_file,"r"); while ($data = fread($fp, 4096)) { xml_parse($parser, $data, feof($fp)); } fclose($fp); xml_parser_free($parser);?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.