Page 1 of 6 123 ... LastLast
Results 1 to 10 of 58

Thread: Google Sitemap v2.7

  1. #1
    Join Date
    Feb 2008
    Location
    Greece
    Posts
    235

    Default Google Sitemap v2.7 Updated

    This is google sitemap for vshre 2.7

    Include channels, videos and tags works only in v2.7

    Just copy this code and save it as sitemap.php at you vshare files.

    Code:
    <?php
    header("content-type:text/xml;charset=utf-8");
    echo "<?xml version='1.0' encoding='UTF-8'?>";
    require 'include/config.php';
    $url = VSHARE_URL;
    echo "
    <urlset xmlns='http://www.google.com/schemas/sitemap/0.84'>
    <url>
      <loc>$url/</loc>
        <priority>1.0</priority>
        <changefreq>hourly</changefreq>
      </url>
      <url>
        <loc>$url/recent/</loc>
        <priority>0.9</priority>
    
        <changefreq>daily</changefreq>
      </url>
      <url>
        <loc>$url/recent/2</loc>
        <priority>0.8</priority>
        <changefreq>daily</changefreq>
      </url>
    
      <url>
        <loc>$url/recent/3</loc>
        <priority>0.7</priority>
        <changefreq>daily</changefreq>
      </url>
      <url>
        <loc>$url/recent/4</loc>
    
        <priority>0.7</priority>
        <changefreq>daily</changefreq>
      </url>
      <url>
        <loc>$url/recent/5</loc>
        <priority>0.7</priority>
        <changefreq>daily</changefreq>
      </url>
      <url>
        <loc>$url/recent/6</loc>
        <priority>0.7</priority>
        <changefreq>daily</changefreq>
      </url>
      <url>
    
        <loc>$url/recent/7</loc>
        <priority>0.7</priority>
        <changefreq>daily</changefreq>
      </url>
      <url>
        <loc>$url/recent/8</loc>
        <priority>0.7</priority>
        <changefreq>daily</changefreq>
      </url>
      <url>
        <loc>$url/recent/9</loc>
        <priority>0.7</priority>
        <changefreq>daily</changefreq>
      </url>
      <url>
        <loc>$url/channels/</loc>
        <priority>0.9</priority>
        <changefreq>weekly</changefreq>
      </url>
      <url>
        <loc>$url/favorites/</loc>
        <priority>0.7</priority>
        <changefreq>daily</changefreq>
      </url>
      <url>
        <loc>$url/featured/</loc>
        <priority>0.8</priority>
        <changefreq>daily</changefreq>
      </url>
      <url>
        <loc>$url/random/</loc>
        <priority>0.7</priority>
        <changefreq>daily</changefreq>
      </url>
      <url>
        <loc>$url/rated/</loc>
        <priority>0.7</priority>
        <changefreq>daily</changefreq>
      </url>";
    
    # channels
    $sql = "SELECT channel_id, channel_name FROM `channels`
                    ORDER BY `channel_sort_order` ASC";
    $res = mysql_query($sql,$conn)
    or die( "Error: " . mysql_error() );
    while ($info = mysql_fetch_row($res)) {
    $SefUrl=strtolower(preg_replace("/[^a-zA-Z0-9]+/","-", $info[1]));
    srand ((double) microtime( )*1000000);
    $random_number = rand(6,7);
    
    echo "
    <url>
    <loc>$url/channel/".$info[0]."/".$SefUrl."/</loc>";
    echo "
    <changefreq>monthly</changefreq>";
    echo "
    <priority>0.$random_number</priority>";
    echo "
    </url>";
    }
    
    # videos
    $sql = "SELECT video_id, video_title, video_add_date FROM `videos` WHERE
               `video_active`='1' AND
               `video_approve`='1' AND
               `video_type`='public'
                ORDER BY `video_id` DESC";
    $res = mysql_query($sql,$conn)
    or die( "Error: " . mysql_error() );
    while ($info = mysql_fetch_row($res)) {
    $SefUrl=strtolower(preg_replace("/[^a-zA-Z0-9]+/","-", $info[1]));
    srand ((double) microtime( )*1000000);
    $random_number = rand(4,6);
    
    echo "
    <url>
    <loc>$url/view/".$info[0]."/".$SefUrl."/</loc>";
    echo "
    <lastmod>".$info[2]."</lastmod>
    <changefreq>monthly</changefreq>";
    echo "
    <priority>0.$random_number</priority>";
    echo "
    </url>";
    }
    # tags
    $sql = "SELECT tag FROM `tags` WHERE
               `active`='1' AND
               `tag_count` > 0
                ORDER BY `tag_count` DESC";
    
    $res = mysql_query($sql,$conn)
    or die( "Error: " . mysql_error() );
    while ($info = mysql_fetch_row($res)) {
    $SefUrl=strtolower(preg_replace("/[^a-zA-Z0-9]+/","-", $info[0]));
    srand ((double) microtime( )*1000000);
    $random_number = rand(1,4);
    
    echo "
    <url>
    <loc>$url/tag/".$SefUrl."/</loc>";
    echo "
    <changefreq>monthly</changefreq>";
    echo "
    <priority>0.$random_number</priority>";
    echo "
    </url>";
    }
    
    mysql_close($conn);
    echo "
    </urlset>";
    ?>

    UPDATED AND WORKING
    Last edited by RAMMSTEIN; 06-26-2009 at 03:53 PM.

  2. #2
    Join Date
    May 2007
    Location
    Planet Earth
    Posts
    1,389

    Default Re: Google Sitemap v2.7

    SWEET! Thanks!
    If it's not fun, stop doing it!

  3. #3

    Default Re: Google Sitemap v2.7

    it shows error :-

    XML Parsing Error: XML or text declaration not at start of entity

  4. #4
    Join Date
    Apr 2009
    Location
    Amsterdam
    Posts
    7

    Default

    Different error here:

    The XML page cannot be displayed

    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. The following tags were not closed: urlset. Error processing resource 'http://yourgasm.net/sitemap.php'.

  5. #5

    Default

    This works - save as sitemap.php

    Code:
        <?php
        echo "<?xml version='1.0' encoding='iso-8859-1'?>";
        echo "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">";
    
        // hostname on which MySQL is (usally localhost)
        $dbhost = "localhost";
        // Database name
        $dbname = "";
        // Username
        $dbuser = "";
        // Password
        $dbpass = "";
    
        // mysql_connect() fnction
        $conn = mysql_connect($dbhost,$dbuser,$dbpass)
        or die("Unable to connect to MySQL.");
    
        // mysql_select_db() function
        mysql_select_db($dbname,$conn)
        or die("Unable to connect to Database $dbname");
    
        $sql = "Select  VID, title, description, adddate, flvdoname, duration from video where approve=1 and active=1";
    
        // execute SQL Command
        $res = mysql_query($sql,$conn)
        or die( "Error: " . mysql_error() );
    
        // Retrieve Results
        while ($info = mysql_fetch_row($res)) {
        $SefUrl=strtolower(preg_replace("/[^a-zA-Z0-9]+/","_", $info[1]));
    
        echo "<url><loc>http://www.site.com/video/".$info[0]."/".$SefUrl."/</loc></url>";
        
        } 
        echo "</urlset>";
    
        // mysql_close() function
        mysql_close($conn);
        ?>

  6. #6
    Join Date
    May 2007
    Location
    Planet Earth
    Posts
    1,389

    Default

    Can't the db login stuff be eliminated by using the config include?

    require 'include/config.php';

    and instead of this echo "<url><loc>http://www.site.com/video/".$info[0]."/".$SefUrl."/</loc></url>";

    put echo "<url><loc>{$base_url}/video/".$info[0]."/".$SefUrl."/</loc></url>";

    or will that bork the whole thing....Imma go try it.
    If it's not fun, stop doing it!

  7. #7

    Default

    I made it as a stand alone script. But both ways are fine

  8. #8
    Join Date
    May 2007
    Location
    Planet Earth
    Posts
    1,389

    Default

    Yeah, the inlude works but I think the DB stuff needs to be this:

    $sql = "Select video_id, video_title, video_description, video_add_date, video_flv_name, video_length from videos where video_approve=1 and video_active=1";
    If it's not fun, stop doing it!

  9. #9
    Join Date
    May 2007
    Location
    Planet Earth
    Posts
    1,389

    Default

    I'm trying to automate this as much as I can so that I can just upload it to all my vshare sites without having to configure each one each time...the only thing I can't get to work is the {$base_url} part. Comes out looking weird

    Code:
    http:///6/using_satchel_and_claymore_in_ctf/http:///etc
    Last edited by grynmoors; 05-16-2009 at 12:37 PM.
    If it's not fun, stop doing it!

  10. #10

    Default

    Quote Originally Posted by grynmoors View Post
    I'm trying to automate this as much as I can so that I can just upload it to all my vshare sites without having to configure each one each time...the only thing I can't get to work is the {$base_url} part. Comes out looking weird

    Code:
    http:///6/using_satchel_and_claymore_in_ctf/http:///etc

    Keep in mind its still xml format even though it has php extension

    Code:
    $config['baseurl']

Page 1 of 6 123 ... LastLast

Similar Threads

  1. [addon] Google Sitemap Generator
    By RAMMSTEIN in forum Template Modifications
    Replies: 5
    Last Post: 11-07-2008, 04:25 AM
  2. Google Video Sitemap
    By CliftonH in forum Web Site Promotion
    Replies: 6
    Last Post: 08-10-2008, 10:20 PM
  3. Sitemap
    By autodafe in forum Feature Requests
    Replies: 23
    Last Post: 02-29-2008, 12:08 AM
  4. New Google video sitemap !!!
    By chadon in forum Feature Requests
    Replies: 2
    Last Post: 12-21-2007, 06:48 PM
  5. Sitemap Generator for vShare
    By autodafe in forum General Discussions
    Replies: 14
    Last Post: 10-24-2007, 03:50 PM

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
  •