Jump to content

stubrook

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

stubrook's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, I have the following code below and all im tyring to do is make use of a query string value inside a function in the class. The if statement im trying to use the query string value is shown below. Does anyone know how to acheive this? Many thanks [code] <?php ini_set("register_globals", "on"); class RSSParser { var $insideitem = false; var $tag = ""; var $title = ""; var $body = ""; function startElement($parser, $tagName, $attrs) { if ($this->insideitem) { $this->tag = $tagName; }     elseif ($tagName == "ITEM")     { $this->insideitem = true; } } function endElement($parser, $tagName) { if ($tagName == "ITEM") { printf("<b>%s</b></dt>", htmlspecialchars(trim($this->title))); printf("%s", htmlspecialchars(trim($this->body))); $this->title = ""; $this->body = ""; $this->insideitem = false; } } function characterData($parser, $data) { if ($this->insideitem) { [b] if ($lang == "en")[/b] { switch ($this->tag) { case "TITLE": $this->title .= $data; break; case "BODY": $this->body .= $data; break; } } } } } $xml_parser = xml_parser_create(); $rss_parser = new RSSParser(); xml_set_object($xml_parser,&$rss_parser); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); $fp = fopen("rss.txt","r")   or die("Error reading RSS data."); while ($data = fread($fp, 4096)) xml_parse($xml_parser, $data, feof($fp)) or die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); fclose($fp); xml_parser_free($xml_parser); ?> [/code]
×
×
  • 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.