SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    West Columbia, SC
    Posts
    622
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Syndicating Custom App

    I have an events calendar for Native American Pow Wows. I want to allow other sites to syndicate some of the information.

    I'd like for them to be able to get a search results list, show events in current month, or events by state. But then have the detailed information still exist on my pages.

    Here is my application:

    http://www.powwows.com/gathering/pw_calendar/

    What is the best method to do this??

    Thanks

  2. #2
    Thinking about Visual Thinking
    Join Date
    May 2003
    Location
    back in South Africa
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you thought of supplying a RSS Feed? You could even supply specialized ones, according to the catagories you would like to make available.

    ... just a thought

  3. #3
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    West Columbia, SC
    Posts
    622
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stefano F.
    Have you thought of supplying a RSS Feed? You could even supply specialized ones, according to the catagories you would like to make available.

    ... just a thought [img]images/smilies/wink.gif[/img]
    First, how can I build an RSS feed of the data in MySQL? How do I set it to pull just current month or a set state?

    Also, what other options are out there for sites that might not have the ability to pull in an RSS feed?

    Thanks

  4. #4
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Umm... There are some scripts available which'll pull out the query you have and put this to XML ?

    Once you've done this then you write a script that some one can put a link on their site leading to the said script which'll read in the XML file and then display it.

    Since someone else might not actually have PHP on their server you could use a Javascript link which then remains neutral for all your users, offering a PHP link as an alternative for those users who do have PHP on their server ?

    Look at the Content Feed article over at www.devarticles.com for more on using Javascript this way.

    Or better yet create a Web Service instead ?

  5. #5
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    West Columbia, SC
    Posts
    622
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I've created a script in PHP to generate the needed XML. But when I view the php page in a browser, it doesn't show up in XML. I'm sure I'm missing some syntax somewhere, but I'm not that familiar with RSS.

    Here's the code:

    PHP Code:
     <?php
    header 
    ("Content-type: text/xml"); // Output file as XML
    echo ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); // The XML declaration
    ?>
     
    <rdf:RDF xmlns:dc="[url=http://purl.org/dc/elements/1.1/]http://purl.org/dc/elements/1.1/[/url]"
     xmlns:h="[url=http://www.w3.org/1999/xhtml]http://www.w3.org/1999/xhtml[/url]"
     xmlns:hr="[url=http://www.w3.org/2000/08/w3c-synd/]http://www.w3.org/2000/08/w3c-synd/[/url]#"
     xmlns:rdf="[url=http://www.w3.org/1999/02/22-rdf-syntax-ns]http://www.w3.org/1999/02/22-rdf-syntax-ns[/url]#"
     xmlns="[url=http://purl.org/rss/1.0/]http://purl.org/rss/1.0/[/url]">
    <channel rdf:about="[url=http://www.powwows.com/rss/calendar.php]http://www.powwows.com/rss/calendar.php[/url]">
    <?php
    $today 
    getdate();
    $month $today['month'];
    $year $today['year'];

    mysql_connect ("localhost""username""password") or die ("Cannot connect to database server.");
    mysql_select_db ("gathering") or die ("Cannot connect to database.");
    $result mysql_query ("SELECT * FROM pw_event WHERE syear='$year' AND smonth='$month' ORDER BY smonth, sdate ASC") or die (mysql_error());
    while (
    $row mysql_fetch_array ($result)) {
     echo (
    " <item rdf:about=\"[url=http://www.powwows.com]http://www.powwows.com\[/url]">");
     echo 
    $row[name];
        echo ("
    </title>\n<dates>");
        echo 
    $row[smonth];
        echo (" ");
        echo 
    $row[sdate];
        echo (" 
    ");
        echo 
    $row[edate];
        echo ("
    ");
        echo 
    $row[syear];
        echo ("
    </dates>\n");
        echo ("
    <location>");
        echo ("
    <city>");
        echo 
    $row[city];
        echo ("
    </city>");
        echo ("
    ");
        echo ("
    <state>");
        echo 
    $row[state];
        echo ("
    </state>");
        echo ("
    </location>\n");
        echo ("
    <link>http://www.powwows.com.com/pw_calendar/pw_event_display.php?eventid=");
        
    echo $row[eventid];
        echo (
    ".php");
        echo (
    "</link>");
        echo (
    "</item>\n\n");
    }
    mysql_free_result ($result);
    ?></rdf:RDF>

  6. #6
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    XML is application/xml no?
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  7. #7
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    West Columbia, SC
    Posts
    622
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That helped!!

    Thanks

  8. #8
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    West Columbia, SC
    Posts
    622
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, here's my error now:

    Whitespace is not allowed at this location. Error processing resource 'http://www.powwows.com/rss/calendar.php'. Line 47, Position 86
    <item rdf:about="http://www.powwows.com"><title>5th Annual Native American Pow Wow & Veterans Gath</title>
    -------------------------------------------------------------------------------------^

  9. #9
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    West Columbia, SC
    Posts
    622
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It doesn't show up here, but the arrow is pointing to the space after &.

  10. #10
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pgowder
    It doesn't show up here, but the arrow is pointing to the space after &.
    The & character is reserved for entities -- use &amp; (to represent & ) instead.

    Edit:

    Lol @ bbcode
    My name is Steve, and I'm a super-villian.

  11. #11
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    West Columbia, SC
    Posts
    622
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm pulling that from MySQL, how can I convert special characters on a query?

  12. #12
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when you are displaying it, either do an str_replace(), or htmlentities() (not sure if there is one just for XML, but I think htmlentities() should do everything you need)
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  13. #13
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jeff Lange
    when you are displaying it, either do an str_replace(), or htmlentities() (not sure if there is one just for XML, but I think htmlentities() should do everything you need)
    Yes, htmlentities correctly converts all entities to their corresponding &ccc; format, solving the XML parse issues, so long as RSS has defined the appropriate entities (like XHTML does)

    [(I've never had a chance to really study RSS, thus I don't know)]
    My name is Steve, and I'm a super-villian.

  14. #14
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    West Columbia, SC
    Posts
    622
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That did it!!

    Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •