medesan adlı üyeden alıntı: mesajı görüntüle
hocam demek istediğim tek sayfada farklı sitelerin rsslerini çekmek. örneğin şuanda internethaber ve aktif haberin rsslerini bir sayfaya div açıp kodları yerleştirdim ama hata veriyor... hatta bu şekilde ( <?php require( "page/rss_1.php" );?> ) farklı bir dizinden çekip sayfanın içine gömsem bile yuinede hata veriyor...
http://www.realmedya.com/sndk.php
Fatal error: Cannot redeclare startelement() (previously declared in /home/realmdy/public_html/sndk.php:47) in /home/realmdy/public_html/sndk.php on line 258
tekrarlanan bilgileri silmen lazım. şu şekilde yaparsan 2li sütun halinde istediğine ulaşırsın
<style type="text/css">
<!--
#internethaber {
    position:absolute;
    left:38px;
    top:32px;
    width:244px;
    height:260px;
    z-index:1;
}
#aktifhaber {
    position:absolute;
    left:288px;
    top:31px;
    width:211px;
    height:261px;
    z-index:2;
}
-->
</style>
<div id="internethaber"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" /> 
<META http-equiv="content-type" content="text/html; charset=windows-1254"/> 
<style type="text/css"> 
<!-- 
.li {color: #cc0000} 
.title { 
font-size:10px; 
color:#000000; 
font-family:Verdana; 
font-weight: bold; 
} 
--> 
</style> 

<?php  

$file = "http://rss.internethaber.com/last_min.xml";  

$rss_channel = array();  
$currently_writing = "";  

$main = "";  

$item_counter = 1;  

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 "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 "ITEMS":  

if (isset($rss_channel[$main][$item_counter][$currently_writing])) {  

$rss_channel[$main][$item_counter][$currently_writing] .= $data;  

} else {  

//print ("rss_channel[$main][$item_counter][$currently_writing] = $data<br>");  

$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 as HTML  

print ("<title>PHP RSS Reader</title><span class='li'><body>");  

if (isset($rss_channel["ITEMS"])) {  

if (count($rss_channel["ITEMS"]) > 1) {  

for($i = 1;$i < count($rss_channel["ITEMS"]);$i++) {  

print ("\n<li><a href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\" target=\"_blank\" style=\"text-decoration: none\"><span class='title'>" . $rss_channel["ITEMS"][$i]["TITLE"] . "</span></br></a></li></b>");  

}  

} else {  

print ("<b>There are no articles in this feed.</b>");  

}  

}  

print ("</span></body></html>");  

?></div>
<div id="aktifhaber"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" /> 
<META http-equiv="content-type" content="text/html; charset=windows-1254"/> 
<style type="text/css"> 
<!-- 
.li {color: #cc0000} 
.title { 
font-size:10px; 
color:#000000; 
font-family:Verdana; 
font-weight: bold; 
} 
--> 
</style> 

<?php  

$file = "http://www.aktifhaber.com/rss/rss.php";  



$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 as HTML  

print ("<title>PHP RSS Reader</title><span class='li'><body>");  

if (isset($rss_channel["ITEMS"])) {  

if (count($rss_channel["ITEMS"]) > 1) {  

for($i = 1;$i < count($rss_channel["ITEMS"]);$i++) {  

print ("\n<li><a href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\" target=\"_blank\" style=\"text-decoration: none\"><span class='title'>" . $rss_channel["ITEMS"][$i]["TITLE"] . "</span></br></a></li></b>");  

}  

} else {  

print ("<b>There are no articles in this feed.</b>");  

}  

}  

print ("</span></body></html>");  

?></div>