* * Modify table colors to meet you needs. It is currently * set up to fit into my site. You can also create your own table * and loops if you like by setting usetable to false and using the * $story array. * * There is no caching, so each page load will add a second due * to the page being fetched by the script. I decided not to use * xml_parser_create functions, instead I used basic line by line * parseing * */ // preferences $usetable = TRUE; // use the table at the end of this script (TRUE/FALSE) $target = '_blank'; // controls where a link opens into $max_items = 4; // controls how many items are shown $showextras = FALSE; // controls if posted by and date are shown (TRUE/FALSE) $showmore = TRUE; // controls is the more link is shown (TRUE/FALSE) $tablewidth = '75%'; // controls the width of the table $nowrap = TRUE; // controls if text wraps or not (TRUE/FALSE) $headername = 'National News'; // the header's name // font and background style sheets // // these hopefully won't interfere with other stylesheets if($usetable) { echo ' '; } // end of preferences $backend = "http://www.thetaxi.org/txnews_xml.php"; $fpread = fopen($backend, 'r'); $items = 0; while(!feof($fpread) ) { $buffer = ltrim(chop(fgets($fpread, 256))); if (($buffer == "") && ($items < $max_items)) { $title = ltrim(chop(fgets($fpread, 256))); $url = ltrim(chop(fgets($fpread, 256))); $date = ltrim(chop(fgets($fpread, 256))); $author = ltrim(chop(fgets($fpread, 256))); //remove html tags $title = ereg_replace( "", "", $title ); $title = ereg_replace( "", "", $title ); $url = ereg_replace( "", "", $url ); $url = ereg_replace( "", "", $url ); //$date = ereg_replace( "", "", $date ); //$date = ereg_replace( "", "", $date ); //$author = ereg_replace( "", "", $author ); //$author = ereg_replace( "", "", $author ); //load into array $story[$items] = array(title => $title, url => $url, date => $date, author => $author ); $items++; } } // build the table if usetable set if($usetable) { echo "\n\n"; echo "\n"; $color = 0; if($nowrap){ $nowrap = 'nowrap'; } else { unset($nowrap); } // loop through $story for ($i=0;$i<$items;$i++) { echo "\n"; if($showextras) { echo "\n"; } // for color alternating rows $color++; if($color > 1) { $color = 0; } } // "more" link to thetaxi.org for all the news if($showmore){ echo "\n"; } echo "
\n$headername\n
\n"; printf(" %s\n", $story[$i][url], $target, $color, htmlspecialchars($story[$i][title])); echo "
\n"; printf(" Posted on %s by %s", date("F d, Y", strtotime($story[$i][date])), htmlspecialchars($story[$i][author])); echo "
"; echo "MORE>>\n"; echo "
\n

"; } fclose($fpread); ?>