1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Google Sitemap generator for your script

Discussion in 'Google Sitemaps' started by SGBoise, Mar 27, 2008.

  1. #1
    Hey Guys,

    I wrote this simple sitemap generator for one of my scripts. Thought I share it you guys. You will have to modify it to work with your own script but it's a good start.


    <?php
    echo "<p>GENERATING SITEMAP</p>";
    echo "Please wait...<br><br>";

    if (!$xmlfile = fopen("../sitemap.xml", "w")) {
    echo "Cannot open file ($filename)";
    exit;
    }

    //
    // Write main website
    //
    fwrite($xmlfile,
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">
    <url>
    <loc>{$website_url]}/</loc>
    <lastmod>".date('Y-m-d')."</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.7</priority>
    </url>
    ");


    //
    // Write all of the links
    //
    $stagarray = explode(",", $searchkeywords);
    for ($i = 0; $i < count($stagarray); $i++) {
    //echo '<li><a href="'.$website.'/tags/'.$stagarray[$i].'.html">'....lfile, "</urlset>"); fclose($xmlfile); ?>
     
    SGBoise, Mar 27, 2008 IP