• 25-12-2008, 15:15:00
    #1
    S.a aşağıdaki php kodla sitelerin rss lerini okutuyorum herşey tamam ama çekilen başlıkların yazı fontunu verdana, regini siyah, başlık sayısınıda 10 ile sınırlandırmak istiyorum ama bi türlü yapamadım yardım edermisiniz lütfen...

    <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}
    -->
    </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\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</br></a></li></b>"); 
    
    } 
    
    } else { 
    
    print ("<b>There are no articles in this feed.</b>"); 
    
    } 
    
    } 
    
    print ("</span></body></html>"); 
    
    ?>
  • 25-12-2008, 15:30:44
    #2
    <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}
    -->
    </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 < 11;$i++) { 
    print ("\n<li><a href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\" target=\"_blank\" style=\"text-decoration: none\"><font style=\"font-family: verdana;color:black;\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</font></br></a></li></b>"); 
    } 
    } else { 
    print ("<b>There are no articles in this feed.</b>"); 
    } 
    } 
    print ("</span></body></html>"); 
    ?>
  • 25-12-2008, 15:33:45
    #3
    <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>"); 
    
    ?>
  • 25-12-2008, 15:48:09
    #4
    Her iki arkadaşada çok teşekkür ederim... her iki koddada farklı yöntemler kullanmış ve ikiside işime çok yarayacak tekrar teşekkür ederim...
  • 25-12-2008, 15:51:25
    #5
    güle güle kullan