Results 1 to 10 of 58

Thread: Google Sitemap v2.7

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Location
    Planet Earth
    Posts
    1,389

    Default

    I have a question, in the original for 2.6 it has this:

    Code:
    echo "<?xml version='1.0' encoding='iso-8859-1'?>";
    echo "<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' xmlns:video='http://www.google.com/schemas/sitemap-video/1.0'>";
    Would the reference to the fact that this is for videos be of any importance?
    If it's not fun, stop doing it!

  2. #2

    Default

    I will try this :)

    Thanks for keeping this updated!!

  3. #3

    Default

    Pimp it works now! great many thanks :)

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

    Default

    Oh good! I couldn't get carefree's code to work with 2.7 so I took RAMMSTEINS code, which looks like this and it works for me in 2.7:

    Code:
    <?php
    header("content-type:text/xml;charset=utf-8");
    
    require 'include/config.php';
    $url = VSHARE_URL;
    
    echo "<?xml version='1.0' encoding='iso-8859-1'?>";
    echo "<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' xmlns:video='http://www.google.com/schemas/sitemap-video/1.0'>";
    
    # 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)) {
    srand ((double) microtime( )*1000000);
    $random_number = rand(6,7);
    $SefUrl=strtolower(preg_replace("/[^a-zA-Z0-9]+/","_", $info[1]));
    
    echo "<url><loc>$url/channel/".$info[0]."/".$info[1]."/</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)) {
    srand ((double) microtime( )*1000000);
    $random_number = rand(4,6);
    $SefUrl=strtolower(preg_replace("/[^a-zA-Z0-9]+/","-", $info[1]));
    
    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)) {
    srand ((double) microtime( )*1000000);
    $random_number = rand(1,4);
    $SefUrl=strtolower(preg_replace("/[^a-zA-Z0-9]+/","_", $info[1]));
    
    echo "<url><loc>$url/tag/".$info[0]."/</loc>";
    echo "<changefreq>monthly</changefreq>";
    echo "<priority>0.$random_number</priority>";
    echo "</url>";
    }
    
    mysql_close($conn);
    
    echo "</urlset>";
    ?>
    The only thing I had to do to my site was remove the ampersand (&) from my channel titles in vShare which caused the same problem as it did with 2.6. I'm weeding thru this to see what I did last time to fix it, but for now I just took that out of my channel titles in vShare admin panel.
    Last edited by grynmoors; 05-18-2009 at 12:09 PM.
    If it's not fun, stop doing it!

  5. #5

    Default This is the one that worked for me

    Quote Originally Posted by grynmoors View Post
    Oh good! I couldn't get carefree's code to work with 2.7 so I took RAMMSTEINS code, which looks like this and it works for me in 2.7:

    Code:
    <?php
    header("content-type:text/xml;charset=utf-8");
    
    require 'include/config.php';
    $url = VSHARE_URL;
    
    echo "<?xml version='1.0' encoding='iso-8859-1'?>";
    echo "<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' xmlns:video='http://www.google.com/schemas/sitemap-video/1.0'>";
    
    # 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)) {
    srand ((double) microtime( )*1000000);
    $random_number = rand(6,7);
    $SefUrl=strtolower(preg_replace("/[^a-zA-Z0-9]+/","_", $info[1]));
    
    echo "<url><loc>$url/channel/".$info[0]."/".$info[1]."/</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)) {
    srand ((double) microtime( )*1000000);
    $random_number = rand(4,6);
    $SefUrl=strtolower(preg_replace("/[^a-zA-Z0-9]+/","-", $info[1]));
    
    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)) {
    srand ((double) microtime( )*1000000);
    $random_number = rand(1,4);
    $SefUrl=strtolower(preg_replace("/[^a-zA-Z0-9]+/","_", $info[1]));
    
    echo "<url><loc>$url/tag/".$info[0]."/</loc>";
    echo "<changefreq>monthly</changefreq>";
    echo "<priority>0.$random_number</priority>";
    echo "</url>";
    }
    
    mysql_close($conn);
    
    echo "</urlset>";
    ?>
    The only thing I had to do to my site was remove the ampersand (&) from my channel titles in vShare which caused the same problem as it did with 2.6. I'm weeding thru this to see what I did last time to fix it, but for now I just took that out of my channel titles in vShare admin panel.


    This one worked for me on 2.7 don't remember whos it is but it works fine google visits every day :rolleyes:



    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 "your database";
        
    // Username
        
    $dbuser "Database username";
        
    // Password
        
    $dbpass "Database password";

        
    // 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 video_id, video_title, video_description, video_add_date, video_flv_name, video_length from videos where video_approve=1 and video_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.viewmyvids.com/video/".$info[0]."/".$SefUrl."/</loc></url>";
        
        } 
        echo 
    "</urlset>";

        
    // mysql_close() function
        
    mysql_close($conn);
        
    ?>

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

  7. #7
    Join Date
    Jun 2009
    Posts
    3

    Lightbulb

    This code works perfect on v2.7 I had to do a small modification to this code because I have a SEO hack to make my video links to end on (.html) this makes google like you a bit more.

    Original
    Code:
    echo "
    <url>
    <loc>$url/view/".$info[0]."/".$SefUrl."/</loc>";
    echo "
    To this
    Code:
    echo "
    <url>
    <loc>$url/view/".$info[0]."/".$SefUrl.".html</loc>";
    echo "
    You can see it working here http://videos.colombiascortvip.com:81/googlesitemap.php



    http://videos.colombiascortvip.com:81

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

    Default

    Quote Originally Posted by ikhebdexfactor View Post
    Pimp it works now! great many thanks :)
    Yours is doing the same thing that mine was doing, it's creating a "list" of all the videos on the site in one long string without a break, antd it's not actually linking them. Try RAMMSTEINS code.
    If it's not fun, stop doing it!

  9. #9

    Default

    changed the code to RAMMSTEINS code works great :)

    Quote Originally Posted by grynmoors View Post
    Yours is doing the same thing that mine was doing, it's creating a "list" of all the videos on the site in one long string without a break, antd it's not actually linking them. Try RAMMSTEINS code.

  10. #10
    Join Date
    May 2009
    Posts
    9

    Default wrong?


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
  •