XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 30th, 2004, 03:21 PM
Mr.spam Mr.spam is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 73 Mr.spam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
RSS feed + PHP

As a PHP file my code works correctly, atleast it displays correctly - however Live bookmarking does not.

As an XML file it does not work in the slighest - infact it just displays the PHP.

This is my first day at XML and Im utterly confused! Help

PHP Code:
<?php
define
("SECURITY_KEY"true);

include(
"includes/connect.php");

function 
escape_upper_chars($text) {
    
// 32-90, 97-122
    
for ($x 0$x strlen($text); $x++) {
        
$w $text{$x};
        if ((
ord($w) < 32) || ((ord($w) > 90) && (ord($w) < 97)) || (ord($w) > 122)) {
            
$q .= '&#'.ord($w).';';
        } else {
            
$q .= $w;
        }
    }
    return 
$q;}

header("Content-type: text/xml");

echo 
"<?xml version=\"1.0\"?>
    <rss version=\"0.91\">
    <channel>
    <title>Wuggawoo RSS feed</title>
    <language>en</language>
    <link>http://www.wuggawoo.com</link>
    <description>Wuggawoo new post monitor</description>\n
    <items>"
;

$limit = (int)$_GET['limit'];
    
if ((
$limit 1) || ($limit 50)) {$limit 15;}  // Set the default number of results

$s mysql_query("SELECT * FROM $forumzDB.forumz_threads ORDER BY lp_time DESC LIMIT $limit");

    while(
$thread mysql_fetch_object($s)) {

    
$title stripslashes(escape_upper_chars($thread_title));
    echo 
"<item>\n"// Begin a new item
    
echo "<title>$thread->thread_title</title>\n"// Send the title
    
echo "<link>http://forumz.wuggawoo.co.uk/index/thread/$thread->tid</link>\n";
    echo 
"<description>".date("l dS of F @ h:ia"$thread->lp_time)."</description>\n";
    echo 
"</item>\n"//End the item

}

echo 
"</items></channel>\n</rss>"// Close the RSS channel

?>

Reply With Quote
  #2  
Old October 2nd, 2004, 06:08 PM
Mr.spam Mr.spam is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 73 Mr.spam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
bump

Reply With Quote
  #3  
Old October 6th, 2004, 07:10 PM
Mr.spam Mr.spam is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 73 Mr.spam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Im guessing I hae to physically write the xml file for each update?

Reply With Quote
  #4  
Old October 7th, 2004, 08:41 AM
tstolber tstolber is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: UK
Posts: 172 tstolber User rank is Private First Class (20 - 50 Reputation Level)tstolber User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 16 h 15 m 56 sec
Reputation Power: 6
It is possible to make PHP write each xml file dynamically from your database - or forum by the looks of it and creat them as files on your server for the world to see.

This is providing you have access to create files server side, which many shared hosting solutions do not.

Also you could run a CRON task to update the XML files every hour say.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > RSS feed + PHP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT