[ABD] Google sitemap mod

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Locked
celeb-x
Registered User
Posts: 30
Joined: Sat Jun 18, 2005 10:31 pm
Location: The Netherlands
Contact:

Post by celeb-x » Thu Jun 30, 2005 12:41 pm

Bump!!!

Error obtaining topic data

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

SELECT t.topic_id, t.topic_type, t.topic_status, p.post_time FROM forum_topics AS t, forum_posts AS p WHERE t.topic_last_post_id=p.post_id AND t.forum_id IN (1,2,3,4,5,7,8,9) ORDER BY t.topic_id LIMIT

Line : 84
File : sitemap.php

dcz
Registered User
Posts: 787
Joined: Sun Feb 13, 2005 5:37 am
Contact:

again

Post by dcz » Fri Jul 01, 2005 9:50 am

Sorry to insist,
but I would appriciate very much if somehone could tell me how to put the sitemap.php file in my web site's root instead of in my forum's root in order to include (hard code) the other pages of my web site (located on level above in the folder's structure), as for now, google is considering the location of the sitemap.php as the entire web's site root and considers pages located elswhere to be out of the site!

Hers is what google says about this:
Location of Sitemap Files [Contents]

The location of a Sitemap file determines the set of URLs that can be included in that Sitemap. A Sitemap file located at http://yoursite.com/catalog/sitemap.gz can include any URLs starting with http://yoursite.com/catalog/ but can not include URLs starting with http://yoursite.com/images/.

If you have the permission to change "http://site.org/path/sitemap.gz", it is safe to assume that you also have permission to provide information for URLs with the prefix "http://site.org/path/". Examples of URLs considered valid in http://yoursite.com/catalog/sitemap.gz include:

http://yoursite.com/catalog/show?item=23
http://yoursite.com/catalog/show?item=233&user=3453

URLs not considered valid in http://yoursite.com/catalog/sitemap.gz include:

http://yoursite.com/image/show?item=23
http://yoursite.com/image/show?item=233&user=3453
http://example.com/catalog/show?item=24

URLs that are not considered valid are dropped from further consideration. It is strongly recommended that you place your Sitemap at the root directory of your web server. For example, if your HTTP Web server is at yoursite.com, then your Sitemap index file would be at "http://yoursite.com/sitemap.gz". In certain cases, you may need to produce different Sitemaps for different paths — e.g. if security permissions in your organization compartmentalize write access to different directories.


My sitemap.php is located in root/marsforum/ and I would like to put it in root/

thx!

dcz

phpBB SEO || phpBB3 SEO Premod || SEO phpBB3
GYM Sitemaps & RSS for phpBB3: GYM Sitemaps & RSS

tomythius
Registered User
Posts: 74
Joined: Sat May 28, 2005 3:05 pm
Location: Queniborough - Leicester - UK
Contact:

Post by tomythius » Fri Jul 01, 2005 11:04 am

I'm sure I already described how to do this earlier in the thread. I did it on my site.
Dig around, I'm *sure* I posted a solution quite early on...

EDIT:
tomythius wrote:
lvsinjin wrote:
tomythius wrote:Mine now sits in the folder above my phpbb root, in the real root of my whole site.
A few hardcoded lines in the template means that my static pages are included in the same map.
DEMO


how is this done :?:

Just put sitemap.php in your root and change the variables to reflect it's new location.
For instance, I changed $phpbb_root_path to 'talk/' which is the location of the phpBB root in relation to the root of my whole site.
I also had to change:

Code: Select all

$server_url = $server_protocol . $server_name . $server_port . $script_name;
to

Code: Select all

$server_url = $server_protocol . $server_name . $server_port . $script_name . '/';
because urls weren't being presented correctly.
All the other files are in the locations described in the mod.
I added a few lines of xml to sitemap_body.tpl in order to include my regular (static) pages to the map:

Code: Select all

<url>
      <loc>http://www.tom.whaletattoo.com/</loc>
      <changefreq>daily</changefreq>
      <priority>1.0</priority>
   </url>
for example.
Tom says so, QED.

dcz
Registered User
Posts: 787
Joined: Sun Feb 13, 2005 5:37 am
Contact:

thx

Post by dcz » Mon Jul 04, 2005 3:07 pm

thanks a lot and sorry for my poor searching kills ;)

phpBB SEO || phpBB3 SEO Premod || SEO phpBB3
GYM Sitemaps & RSS for phpBB3: GYM Sitemaps & RSS

vossen
Registered User
Posts: 123
Joined: Thu Aug 21, 2003 9:11 am

Post by vossen » Wed Jul 06, 2005 6:48 am

hi there, i got a sql error by doing:

Code: Select all

INSERT INTO `phpbb_config` VALUES ('sitemap_announce_priority', '1.0');
INSERT INTO `phpbb_config` VALUES ('sitemap_default_priority', '0.5');
INSERT INTO `phpbb_config` VALUES ('sitemap_sort', 'DESC');
INSERT INTO `phpbb_config` VALUES ('sitemap_sticky_priority', '0.75');
INSERT INTO `phpbb_config` VALUES ('sitemap_topic_limit', '250');
error msg:

MySQL said: Documentation
#1136 - Column count doesn't match value count at row 1


any idea what went wrong?
regards
vossen

vossen
Registered User
Posts: 123
Joined: Thu Aug 21, 2003 9:11 am

Post by vossen » Wed Jul 06, 2005 7:14 am

been able to fix it, needed to add :

Code: Select all

, '1'
so it looks like this:

Code: Select all

INSERT INTO `phpbb_config` VALUES ('sitemap_announce_priority', '1.0', '1');
INSERT INTO `phpbb_config` VALUES ('sitemap_default_priority', '0.5', '1');
INSERT INTO `phpbb_config` VALUES ('sitemap_sort', 'DESC', '1');
INSERT INTO `phpbb_config` VALUES ('sitemap_sticky_priority', '0.75', '1');
INSERT INTO `phpbb_config` VALUES ('sitemap_topic_limit', '250', '1');
and it works!
thanks

wakeup
Registered User
Posts: 13
Joined: Thu Jul 07, 2005 4:39 pm
Contact:

Post by wakeup » Thu Jul 07, 2005 4:48 pm

I have installed sitemap mod and it only generate this style links:
El problema que veo es que solo genera enlaces al estilo
http://hhdirecto.webcindario.com/foro/v ... php?t=5165
http://hhdirecto.webcindario.com/foro/v ... php?t=5163

But not generate this style:
http://hhdirecto.webcindario.com/foro/v ... c&start=20
(for topics with 2 pages)
http://hhdirecto.webcindario.com/foro/viewforum.php?f=3 (forum page)
http://hhdirecto.webcindario.com/foro/v ... 0&start=50
(forums with some pages)

Do you know how i can get it?
THankss

My sitempa file: http://hhdirecto.webcindario.com/foro.xml

User avatar
jarosciak
Registered User
Posts: 107
Joined: Thu Dec 18, 2003 4:37 pm
Location: Toronto, Canada
Contact:

Post by jarosciak » Fri Jul 22, 2005 2:25 am

Hi All, not sure where to post this.
I amended original code from http://www.pentapenguin.com and added cutting of files to 49000 URLs pieces. Also gzipping it.
So only file submitted to google sitemaps is: sitemap.xml.
It will contain linking to all *.gz files.

Here is the code:

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . "common.$phpEx");

// Begin Configuration Section
$included_forum_ids = array();
$excluded_forum_ids = array();
// End Configuration Section

if ( count($included_forum_ids) > 0 )
{
	$included_forum_ids_sql = 'forum_id IN (' . implode(', ', $included_forum_ids) . ')';
}

if ( count($excluded_forum_ids) > 0 )
{
	$excluded_forum_ids_sql = 'forum_id NOT IN (' . implode(', ', $excluded_forum_ids) . ')';
}

if ( ( count($included_forum_ids) > 0 ) && ( count($excluded_forum_ids) > 0 ) )
{
	$and = 'AND';
}

if ( ( count($included_forum_ids) > 0 ) || ( count($excluded_forum_ids) > 0 ) )
{
	$where = 'WHERE';
}

$sql = "SELECT topic_id, forum_id, topic_time, topic_type FROM " . TOPICS_TABLE . " $where $included_forum_ids_sql $and $excluded_forum_ids_sql ORDER BY topic_time DESC";

if ( !$result = $db->sql_query($sql) )
{
	message_die(GENERAL_ERROR, 'Error: could not retrive topic IDs', '', __LINE__, __FILE__, $sql);
}

$protocol = ( $board_config['cookie_secure'] == 0 ) ? 'http://' : 'https://';
$servername = $board_config['server_name'];
$port = ( $board_config['server_port'] == '80' ) ? '' : ':' . $board_config['server_port'];
$path = $board_config['script_path'];


$count1 = 1;

while ( $row = $db->sql_fetchrow($result) )
{
    $count = $count +1;

if ($count == ($count1*48000)) 
{
$memory = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$memory .= '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"' . "\n";
$memory .= 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n";
$memory .= 'xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84' . "\n";
$memory .= 'http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">' . "\n";
$memory .= $output;
$memory .= "</urlset>\n";

$gzdata = gzencode($memory, 9);
$fp = fopen("sitemap".$count1.".xml.gz", "w");
fwrite($fp, $gzdata);
fclose($fp);

$count1 = $count1+1;

$output = "";
$memory = "";
}
	$topic_id = $row['topic_id'];
	$forum_id = $row['forum_id'];
	$lastmodified = date('Y-m-d\TG:i:s+00:00', $row['topic_time']);
	$viewtopic = "/about$topic_id.html";
	$priority = ( $row['topic_type'] == POST_STICKY || $row['topic_type'] == POST_ANNOUNCE ) ? '1.0' : '0.5';
	$output .= "<url><loc>$protocol$servername$port$path$viewtopic</loc><lastmod>$lastmodified</lastmod><changefreq>weekly</changefreq><priority>$priority</priority></url>\n";
//header('Content-type: application/xml');
}


// write the rest

$memory = '<' . '?xml version="1.0" encoding="UTF-8"?' . '>' . "\n";
$memory .= '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n";
$memory .= $output;
$memory .= "</urlset>\n";
$gzdata = gzencode($memory, 9);
$fp = fopen("sitemap".$count1.".xml.gz", "w");
fwrite($fp, $gzdata);
fclose($fp);
$output = "";
$memory = "";

$count1 = $count1+1;

//header('Content-type: application/xml');

//$count1 = $count1 -1;

$finalsm = '<?xml version="1.0" encoding="UTF-8"?>'. "\n";
$finalsm .= '<sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84"'. "\n";
$finalsm .= 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'. "\n";
$finalsm .= 'xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84'. "\n";
$finalsm .= 'http://www.google.com/schemas/sitemap/0.84/siteindex.xsd">'. "\n";

$a = 1;
while ($a<$count1) {
$finalsm .= '<sitemap>'. "\n";
   $finalsm .='<loc>'.$protocol.''.$servername.''.$port.''.$path.'/'."sitemap".$a.".xml.gz".'</loc>'. "\n";
    $finalsm .='<lastmod>'.$lastmodified.'</lastmod>'. "\n";
    $finalsm .='</sitemap>'. "\n";
   $a=$a+1;
   }

$finalsm .= '</sitemap></sitemapindex>';

$fp = fopen("sitemap.xml", "w");
fwrite($fp, $finalsm);
fclose($fp);

 echo "<br><br>Finished gzipping!";
?>

kulinar
Registered User
Posts: 651
Joined: Thu Feb 17, 2005 7:31 pm
Contact:

Post by kulinar » Fri Jul 22, 2005 6:51 am

jarosciak wrote: Hi All, not sure where to post this.
I amended original code from http://www.pentapenguin.com and added cutting of files to 49000 URLs pieces.
You should refer to http://www.pentapenguin.com for support :wink:

vladd44
Registered User
Posts: 7
Joined: Tue Jul 20, 2004 2:05 pm

Post by vladd44 » Sun Jul 24, 2005 4:42 pm

Great mod.

After adding my static pages from non forum related pages to the tpl file, and designating it to another folder it was great.

Thanks.

rAdic
Registered User
Posts: 426
Joined: Mon Apr 25, 2005 11:32 pm
Contact:

Post by rAdic » Sun Aug 07, 2005 1:09 am

when I add the SQL INSERT INTO `phpbb_config` VALUES... etc

I get the follwing error?

#1136 - Column count doesn't match value count at row 1

rAdic
Registered User
Posts: 426
Joined: Mon Apr 25, 2005 11:32 pm
Contact:

Post by rAdic » Sun Aug 07, 2005 1:27 am

well i added the sql myself but im unsure why that happens?

rAdic
Registered User
Posts: 426
Joined: Mon Apr 25, 2005 11:32 pm
Contact:

Post by rAdic » Sun Aug 07, 2005 2:36 am

this doesn't work for me?

all i get is this:

<?xml version="1.0" encoding="UTF-8" ?>
- <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
- <url>
<loc>http://www.mysite.com/</loc>
<changefreq>always</changefreq>
<priority>1.0</priority>
</url>
</urlset>

wheres the rest of it?

kjcdude
Registered User
Posts: 154
Joined: Mon Sep 27, 2004 10:23 pm
Location: Southern California
Contact:

Post by kjcdude » Tue Aug 09, 2005 12:54 am

For some reason on my sitemap today i got an invalid date error from google.

Mine and googles recomended date
2005-08-08T11:34:29+00:00
2004-10-26T08:56:39+00:00

There in the exact same format...

I resubmited my sitemap to google, hopefully i dont get an error this time.

http://theocsucks.com/sitemap.php
-Kyle

User avatar
beggers
Registered User
Posts: 1257
Joined: Fri Nov 23, 2001 8:19 pm
Location: Las Vegas
Contact:

Post by beggers » Tue Aug 09, 2005 1:04 am

I installed this mod on two phpBB sites and it works great!

Now I'm wondering if anyone knows of a similar mod that would scan a non-phpBB site. Any suggestions would be greatly appreciated!

Locked

Return to “[2.0.x] MODs in Development”