• [MOD] Google Sitemap for your gallery 5 0 5 1
Currently:  

Author Topic: [MOD] Google Sitemap for your gallery  (Read 262458 times)

0 Members and 1 Guest are viewing this topic.

Offline __G__

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: [MOD] Google Sitemap for your gallery
« Reply #30 on: February 04, 2007, 02:36:55 PM »
here it is bro

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.420
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: [MOD] Google Sitemap for your gallery
« Reply #31 on: February 04, 2007, 02:41:18 PM »
why you don't use my code???


Code: [Select]
<?
# Create Google Sitemap for 4images
# Created by Mai Minh (minh@maingo.com http://www.vna2z.com)
# Modified by Oliver van der Werf (info@flash-webdesign.de http://www.flash-webdesign.de)
# Date: 28/11/2006 | 02.01.2007
# You can send ping to Google with this request: http://www.google.com/webmasters/sitemaps/ping?sitemap=URL_TO_YOUR_SITEMAP
#---------------------------------

require("config.php");

$link=mysql_connect("$db_host","$db_user","$db_password");
mysql_select_db("$db_name") or die ("Cannot connect database!");

# 4images top page (with trailing slash)
$gallery_url = 'http://www.picsforfree.de/';

# Priotity
//select between 0.0 and 1.0
//0.0 identifies the lowest priority page(s) on your website
//1.0 identifies the highest priority page(s) on your website
$prio_img = 0.5;
$prio_cat = 0.8;
$prio_profile = 0.3;

# Frequency
//"always", "hourly", "daily", "weekly", "monthly", "yearly" or "never"
$freq_img = 'yearly';
$freq_cat = 'daily';
$freq_profile = 'daily';

# Use Short URLs
$shortURL = 1; // 0 or 1

# Print XML header
xml_head();

# Print URLs
$categories = mysql_query('SELECT cat_id FROM ' . $table_prefix . 'categories');
while ($category = mysql_fetch_array($categories))
{
$catid = $category['cat_id'];
if ($shortURL == 1) {
$cat_url = $gallery_url.'cat'.$catid.'.htm';
}else {
$cat_url = $gallery_url.'categories.php?cat_id='.$catid;
}

print_xml($cat_url,$prio_cat,'',$freq_cat);
}

$images = mysql_query('SELECT image_id,image_active,image_date FROM ' . $table_prefix . 'images ');
while ($image = mysql_fetch_array($images))
{
if ($image['image_active'] == 1) {
$imgid = $image['image_id'];
$date = $image['image_date'];
$date = date("Y-m-d",$date)."T".date("H:i:s",$date)."+00:00";
if ($shortURL == 1) {
$img_url = $gallery_url.'img'.$imgid.'.htm';
}else{
$img_url = $gallery_url.'details.php?image_id='.$imgid;
}
print_xml($img_url,$prio_img,$date,$freq_img);
}
}

$profiles = mysql_query('SELECT user_id, user_lastaction FROM ' . $table_prefix . 'users WHERE user_id >= "1"');
while ($profile = mysql_fetch_array($profiles))
{

$profileid = $profile['user_id'];
$date = $profile['user_lastaction'];
$date = date("Y-m-d",$date)."T".date("H:i:s",$date)."+00:00";
$profile_url = $gallery_url.'member.php?action=showprofile&amp;user_id='.$profileid;
print_xml($profile_url,$prio_profile,$date,$freq_profile);
}

# Print XML footer
xml_foot();

function xml_head() {
$freq = 'daily';
$priority = '1.0';
$mod = date("Y-m-d")."T".date("H:i:s")."+00:00";
echo "<?xml version='1.0' encoding='UTF-8'?>
<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xsi:schemaLocation=\"http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd\">";
}

#-----------------------------------------------
# xml_foot
#-----------------------------------------------
function xml_foot() {
echo "
</urlset>";
}

#-----------------------------------------------
# print_xml
#-----------------------------------------------
function print_xml($url,$priority,$lastmod,$changefreq) {
$temp = "<url>
<loc>$url</loc>";
$temp .= "  <priority>$priority</priority>";
if ($lastmod != '') {
$temp .="  <lastmod>$lastmod</lastmod>";
}
$temp .= "  <changefreq>$changefreq</changefreq>
</url>";
echo $temp;
}
?>


Offline __G__

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: [MOD] Google Sitemap for your gallery
« Reply #32 on: February 04, 2007, 02:56:41 PM »
ok bro using da code u gave me thx bro

Offline cpuswe

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: [MOD] Google Sitemap for your gallery
« Reply #33 on: February 04, 2007, 10:30:00 PM »
Works great! Thanks both!

Got a "Parse error: syntax error, unexpected T_STRING"

replaced

echo "<?xml version='1.0' encoding='UTF-8'?>

with

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>


Dont know if its a cut/paste/firefox/IE/PHP error but that solved it.

/Thomas

Offline medo007

  • Newbie
  • *
  • Posts: 29
  • Internet addict
    • View Profile
Re: [MOD] Google Sitemap for your gallery
« Reply #34 on: February 06, 2007, 12:19:52 AM »
I still can't get sitemap.xml file!  :(
mEDO

Offline son_gokou

  • Full Member
  • ***
  • Posts: 199
    • View Profile

Offline SAD

  • Newbie
  • *
  • Posts: 23
    • View Profile
    • Туристические ФотоАльбомы
Re: [MOD] Google Sitemap for your gallery
« Reply #36 on: May 18, 2007, 09:39:11 AM »
What to avoid mistakes at processing google the robot of categories, it is necessary a code

Code: [Select]
$categories = mysql_query('SELECT cat_id FROM ' . $table_prefix . 'categories');
while ($category = mysql_fetch_array($categories))
{
$catid = $category['cat_id'];
if ($shortURL == 1) {
$cat_url = $gallery_url.'cat'.$catid.'.htm';
}else {
$cat_url = $gallery_url.'categories.php?cat_id='.$catid;
}

print_xml($cat_url,$prio_cat,'',$freq_cat);
}

replace

Code: [Select]
$categories = mysql_query('SELECT cat_id FROM ' . $table_prefix . 'categories');
while ($category = mysql_fetch_array($categories))
{
$catid = $category['cat_id'];
if ($shortURL == 1) {
$cat_url = $gallery_url.'cat'.$catid.'.htm';
}else {
$cat_url = $gallery_url.'categories.php?cat_id='.$catid;
}

$date = date("Y-m-d")."T".date("H:i:s")."+00:00";
print_xml($cat_url,$prio_cat,$date,$freq_cat);
}
Sergey


Offline prive

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: [MOD] Google Sitemap for your gallery
« Reply #37 on: May 21, 2007, 04:03:25 PM »
In which directory this the file .htaccecs , is necessary to create one new one in the root of 4i?

In GOOGLE:

That direction is necessary to write in gloogle for sitemap:
http://www.site.com/sitemap.xml
ór
http://www.site.com/google.php

thanks
« Last Edit: May 21, 2007, 04:37:26 PM by prive »

Offline Falldog

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: [MOD] Google Sitemap for your gallery
« Reply #38 on: May 26, 2007, 07:54:57 AM »
Nifty code, thank you very much.

My one question is there a way I can get it to output the rewrite URL I use on my site like http://www.imgdump.info/cat-funny-39.htm instead of http://www.imgdump.info/cat39.htm?

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [MOD] Google Sitemap for your gallery
« Reply #39 on: July 05, 2007, 03:06:15 AM »
You may need to add this line to you htaccess to get the file to work

RewriteEngine On
As long as I can finish my site before I die.

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [MOD] Google What is the importance of this part of the code
« Reply #40 on: July 05, 2007, 04:17:55 AM »
# Frequency
//"always", "hourly", "daily", "weekly", "monthly", "yearly" or "never"
$freq_img      = 'yearly';
$freq_cat      = 'daily';
$freq_profile   = 'daily';

Does that mean daily indexing?
As long as I can finish my site before I die.

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [MOD] Google Sitemap for your gallery
« Reply #41 on: July 05, 2007, 04:47:51 AM »
and would this

# Use Short URLs
$shortURL      = 1; // 0 or 1

which one is for if you dont have the short url mod-

0 or 1?
As long as I can finish my site before I die.

Offline Buggy Driver

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: [MOD] Google Sitemap for your gallery
« Reply #42 on: July 05, 2007, 11:37:38 AM »
Its actually very easy (once you know the answer  :wink:)

1 = ON
0 = OFF

so in your case, you don’t need the shortURL so it has to be off     
$shortURL   = 0;   



And this maybe off interest to some of you.
I have several private categories and if I give those url s to Google it will end up at the start page because Google doesn’t have permission to view the image.  I changed the query string so that Google will only get the url for public images.

Code: [Select]
$categories = mysql_query('SELECT cat_id FROM ' . $table_prefix . 'categories WHERE auth_viewimage = 0');

and
Code: [Select]
$images = mysql_query('SELECT image_id,image_active,image_date
                       FROM ' . $table_prefix . 'images
                       WHERE image_active = 1
                       AND cat_id IN (SELECT cat_id
                                      FROM 4images_categories
                                      WHERE auth_viewimage = 0)'); 

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [MOD] Google Sitemap for your gallery
« Reply #43 on: July 05, 2007, 05:40:30 PM »
Thanks!

Appreciate it

Robert
As long as I can finish my site before I die.

Offline ashfaq

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Re: [MOD] Google Sitemap for your gallery
« Reply #44 on: July 21, 2007, 11:06:03 AM »
I am using short url and daily update my site, plz tell me will google.php file updates sitemap every time when i update my site ?
one more thing is i give this link "http://www.yourdomain.com/sitemap.xml" but i didnt have sitemap.xml file, will google.php will create sitemap.xml itself ?
Plz can you give code file in zip format for short url enables, infact i am afraid that i will make some mistake in php file.
I will upload wallpapers and gd libarary etc... will create thumbnails itself, Can you plz tell how to control thumbnails size ?
AcidGod Dear Plz Help i will be very thankfull to you and i am using version 1.74

 

Post your comments here