<?php
include("config.php");
if (empty($title)) { $title = $_SERVER['HTTP_HOST']; }
$feed = "http://news.google.com/news?q=$keyword&ie=UTF-8&output=rss";
if (empty($keyword))
{ $feed = "http://news.google.com/nwshp?ie=UTF-8&oe=UTF-8&hl=en&tab=wn&q=&output=rss"; }
$keyword2 = ucfirst($keyword);
if (empty($keyword2))
{ $keyword2 = "World"; }
$feed = str_replace (" ", "+", $feed);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
<title><?php echo ucfirst($title); ?> - <?php echo "The Latest $keyword2 News and Information" ?></title>
<style type="text/css">
* {
margin: 0px;
}
/* Global Elements */
body {
background: #F0F8FA;
font: 0.75em Arial;
color: #<?php echo $text_color; ?>;
text-align: center;
}
fieldset {
border: 0px;
padding: 0px;
}
form {
padding: 0px;
}
#ttext
{
font-weight: none;
text-transform: uppercase;
text-decoration: none;
}
#ttext a {
text-decoration: none;
font-weight: none;
}
#ttext a:hover {
text-decoration: none;
font-weight: none;
}
a {
color: #<?php echo $link_color; ?>;
}
a:hover {
text-decoration: none;
}
.clear {
clear: both;
height: 0%;
font-size: 0%;
}
/* Top container */
#container {
width: 769px;
margin: 20px auto 20px auto;
text-align: left;
background: url(images/container_bg.gif) repeat-y center;
}
#content {
padding: 24px 20px 0px 21px;
background: url(images/top.gif) no-repeat;
}
/* Heading */
#title {
background: url(images/gradient.gif) repeat-x;
height: 95px;
padding: 0px 20px 0px 23px;;
}
#title h1 {
font: 2.0em Georgia;
color: #<?php echo $link_color; ?>;
padding: 30px 0px;
float: left;
}
/* Search Box */
#search {
float: right;
color: #<?php echo $text_color; ?>;
width: 240px;
font-size: 0.9em;
padding-top: 25px;
}
#search .label {
margin-top: 10px;
display: block;
float: left;
width: 60px;
}
#search .box {
background: url(images/search_box.gif) no-repeat;
float: left;
padding: 9px 10px;
}
#search .box input {
font: 1.0em Arial;
color: #<?php echo $text_color; ?>;
width: 152px;
border: 0px;
padding: 0px;
margin: 0px;
}
#search .go {
float: right;
margin-top: 0px;
font: 1.5em Arial;
width: 60px;
padding: 3px 0px;
}
/* Main Content */
#main {
margin-top: 15px;
padding: 0px 0px 0px 20px;
background: url(images/main_bg.gif);
}
#main #left {
line-height: 2.1em;
float: left;
width: 450px;
}
#main #left h1 {
color: #<?php echo $link_color; ?>;
font: 1.7em Georgia;
margin-bottom: 4px;
}
#main #left .one {
font-size: 0.9em;
}
#main #right {
width: 200px;
float: right;
}
#main #right h1 {
background: url(images/h1.gif) no-repeat;
font: 1.2em Arial;
padding: 11px 0px 11px 20px;
}
#main #right #list a {
background: url(images/a.gif) repeat-x bottom;
display: block;
text-decoration: none;
padding: 11px 20px;
}
#main #right #list a:hover {
text-decoration: underline;
}
#main #right #list2 {
padding: 0px 5px;
}
/* Footer */
#footer {
background: url(images/bottom.gif) no-repeat bottom;
text-align: right;
padding: 0px 20px 27px 21px;
margin-top: 2px;
}
#footer .bar {
background: #FBFBFB;
padding: 7px 14px 7px 0px;
font-size: 0.9em;
}
</style>
</head>
<body>
<div id="container">
<div id="content">
<script type="text/javascript"><!--
google_ad_client = "<?php echo $adsense_publisher_id; ?>";
google_ad_width = 728;
google_ad_height = 15;
google_ad_format = "728x15_0ads_al";
//2007-08-22: QuickMinisite
google_ad_channel = "2820869829";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "<?php echo $link_color; ?>";
google_color_text = "000000";
google_color_url = "008000";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<div id="title">
<h1><div id="ttext"><a href="index.php"><?php echo $title; ?></a></div></h1>
<form name="NameForm" method="get" action="redirect.php">
<fieldset>
<div id="search">
<div class="box"><input type="text" value="<?php print($name);?>" name="name" size="20" /></div>
<input type="submit" class="go" value="Search" />
</div>
</fieldset>
</form>
</div>
<script type="text/javascript"><!--
google_ad_client = "<?php echo $adsense_publisher_id; ?>";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
//2007-08-22: QuickMinisite
google_ad_channel = "2820869829";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "<?php echo $link_color; ?>";
google_color_text = "<?php echo $text_color; ?>";
google_color_url = "<?php echo $text_color; ?>";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<div id="main">
<div id="left">
<?php
set_time_limit(0);
$file = "$feed";
$rss_channel = array();
$currently_writing = "";
$main = "";
$item_counter = 0;
function startElement($parser, $name, $attrs) {
global $rss_channel, $currently_writing, $main;
switch($name) {
case "RSS":
case "RDF:RDF":
case "ITEMS":
$currently_writing = "";
break;
case "CHANNEL":
$main = "CHANNEL";
break;
case "IMAGE":
$main = "IMAGE";
$rss_channel["IMAGE"] = array();
break;
case "ITEM":
$main = "ITEMS";
break;
default:
$currently_writing = $name;
break;
}
}
function endElement($parser, $name) {
global $rss_channel, $currently_writing, $item_counter;
$currently_writing = "";
if ($name == "ITEM") {
$item_counter++;
}
}
function characterData($parser, $data) {
global $rss_channel, $currently_writing, $main, $item_counter;
if ($currently_writing != "") {
switch($main) {
case "CHANNEL":
if (isset($rss_channel[$currently_writing])) {
$rss_channel[$currently_writing] .= $data;
} else {
$rss_channel[$currently_writing] = $data;
}
break;
case "IMAGE":
if (isset($rss_channel[$main][$currently_writing])) {
$rss_channel[$main][$currently_writing] .= $data;
} else {
$rss_channel[$main][$currently_writing] = $data;
}
break;
case "ITEMS":
if (isset($rss_channel[$main][$item_counter][$currently_writing])) {
$rss_channel[$main][$item_counter][$currently_writing] .= $data;
} else {
$rss_channel[$main][$item_counter][$currently_writing] = $data;
}
break;
}
}
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
if (!($fp = fopen($file, "r"))) {
die("could not open XML input");
}
while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}
xml_parser_free($xml_parser);
// output HTML
if (isset($rss_channel["ITEMS"])) {
if (count($rss_channel["ITEMS"]) > 0) {
for($i = 0;$i < count($rss_channel["ITEMS"]);$i++) {
if (isset($rss_channel["ITEMS"][$i]["LINK"])) {
print ("\n<div class=\"itemtitle\"><h1><a href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></h1></div>");
} else {
print ("\n<div class=\"itemtitle\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</div>");
}
print ("<div class=\"itemdescription\">" . $rss_channel["ITEMS"][$i]["DESCRIPTION"] . "</div><br />"); }
} else {
print ("<b>There are no articles in this feed.</b>");
}
}
?>
</div>
<div id="right">
<h1>Popular Searches</h1>
<div id="list">
<?php include("searches.php"); ?>
</div>
<h1>Related Links</h1>
<div id="list2">
<script type="text/javascript"><!--
google_ad_client = "<?php echo $adsense_publisher_id; ?>";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_ad_type = "text_image";
//2007-08-22: QuickMinisite
google_ad_channel = "2820869829";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "<?php echo $link_color; ?>";
google_color_text = "<?php echo $text_color; ?>";
google_color_url = "<?php echo $text_color; ?>";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</div>
<p class="clear" />
</div>
</div>
<p class="clear" />
<div id="footer">
<div class="bar">
Copyright © 2007 <?php echo ucfirst($title); ?> | Powered by <a href="http://www.quickminisite.com">Quick Minisite</a>
</div>
</div>
</div>
</body>
</html>