Posted on: 10/13/03 06:01pm
By: wlparks
// Custom RDF / RSS feed on static page function static_rdf($blockid = false) { $error = array(); if ($blockid != false && is_numeric($blockid) && $blockid != "") { global $_TABLES; if (DB_getItem( $_TABLES['blocks'], 'type', "bid = '{$blockid}'" ) == 'portal') { $sql = "SELECT UNIX_TIMESTAMP(rdfupdated) as date, content, rdfurl FROM {$_TABLES['blocks']} WHERE bid = '" . $blockid . "'"; $result = DB_query( $sql ); $A = DB_fetchArray( $result ); if ( COM_rdfCheck($blockid, $A['rdfurl'], $A['date'] )) { $A['content'] = DB_getItem( $_TABLES['blocks'], 'content', "bid = '{$blockid}'" ); } $return = $A['content']; } else { $error[] = 'Block is not of Portal Type'; } } else { $error[] = 'Is not a valid BlockID'; } if (count($error) > 0) { $return = "Something is wrong with the blockid that you entered. Fix this. Otherwise there could be issues"; $return .= '<ul>'; for ( $x = 0; count($error) > $x; $x++ ) { $return .= '<li>' . $error[$x] . '</li>'; } $return .= "</ul>"; } return $return; }
$return = static_rdf('82');
return $return;
Posted on: 10/13/03 06:30pm
By: wlparks
Posted on: 12/27/05 03:14pm
By: jackbox
Posted on: 12/27/05 04:15pm
By: beewee
$insideitem = false; $tag = ""; $title = ""; $description = ""; $link = ""; $locations = array('feed1URL','feed2URL','feed3URL'); srand((float) microtime() * 10000000); // seed the random gen $random_key = array_rand($locations); function startElement($parser, $name, $attrs) { global $insideitem, $tag, $title, $description, $link; if ($insideitem) { $tag = $name; } elseif ($name == "ITEM") { $insideitem = true; } } function endElement($parser, $name) { global $insideitem, $tag, $title, $description, $link; if ($name == "ITEM") { printf("<a href='%s' target=new><b>%s</b></a>", trim($link),htmlspecialchars(trim($title))); printf("<dt>%s<br><br>",htmlspecialchars(trim($description))); $title = ""; $description = ""; $link = ""; $insideitem = false; } } function characterData($parser, $data) { global $insideitem, $tag, $title, $description, $link; if ($insideitem) { switch ($tag) { case "TITLE": $title .= $data; break; case "DESCRIPTION": $description .= $data; break; case "LINK": $link .= $data; break; } } } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); $fp = fopen($locations[$random_key], '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);
Posted on: 01/21/06 03:41pm
By: graffixjones
Posted on: 01/21/06 06:14pm
By: beewee