PHP script output to xml format

Discussion in 'PHP' started by PinoyIto, Sep 11, 2006.

  1. #1
    I have created a php script that will generate link to all pages of my site and I use it as my site map, but the problem I can't submit this in google site map tool. I need to covert it to xml format. Will you please post a sample how convert the output of my script into xml format.
     
    PinoyIto, Sep 11, 2006 IP
  2. sacx13

    sacx13 Active Member

    Messages:
    438
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Just use echo to generate your sitemap script :) if you already have the url and you know what priority have this urls just :
    
    echo '
            <url>
                    <loc>'.$url.'</loc>
                    <lastmod>',$lastmod, '</lastmod>
                    <changefreq>', $change_freq, '</changefreq>^
                    <priority>', $priority, '</priority>
            </url>';
    
    Code (markup):
    Just study a xml sitemap and you will the the entire structure ...

    Regards
     
    sacx13, Sep 12, 2006 IP