Page 1 of 2

Google Sitemap

Posted: Thu 29. Dec 2005, 11:25
by markoehl
Implemented in Version phpwcms 1.2.8

Posted: Thu 29. Dec 2005, 11:50
by Fulvio Romanin
a demo, please? :D

Posted: Thu 29. Dec 2005, 17:53
by squidi
hi markoehl,

nice work ! works with phpwcms 1.2.6 ( 14.12.05 ) :P don't forget chmod 666 to sitemap.xml ...

squidi

Posted: Tue 3. Jan 2006, 23:45
by Glovebox
This doesnt support re-written urls?

Sitemaps

Posted: Wed 4. Jan 2006, 10:50
by Buletti
Hi Folks,
if i use thise sitemap hack and i transer it to google, google says.

this format is not supported

Any ideas ?

Re: Sitemaps

Posted: Wed 4. Jan 2006, 10:59
by markoehl
Buletti wrote:Hi Folks,
if i use thise sitemap hack and i transer it to google, google says.

this format is not supported

Any ideas ?
Can you post the link of the sitemap.xml file?

Or checkout new version Get the new Files http://www.pagewerkstatt.ch/phpwcms_mod_sitemap.zip

Posted: Wed 4. Jan 2006, 11:02
by markoehl
Glovebox wrote:This doesnt support re-written urls?
As much I know rewritten urls works only for the structure. This scrpt is reading the content from phpwcms_article.. But I will have a closer look at that..

Posted: Wed 4. Jan 2006, 23:07
by arkon
two suggestions:

1. in googleSitemap.inc.php on line 62 after

Code: Select all

	function generateSitemap()
	{
i would replace

Code: Select all

		$strSitemap = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
		$strSitemap .= "<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">\n";
with

Code: Select all

		$strSitemap = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
		$strSitemap .= "<?xml-stylesheet type=\"text/xsl\" href=\"gss.xsl\"?>\n";
		$strSitemap .= "<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\">\n";
this will format your sitemap in a nice way.

2. in article.editcontent.inc.php on line 33 i would add at the end of the sql-statement

Code: Select all

WHERE article_public=1 AND article_aktiv=1 AND article_nositemap=1
so it saves only active and public articles and articles that are marked for the phpwcms-sitemap-module.

the correct line would be

Code: Select all

$sql = "SELECT article_id, article_cid, date_format(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date FROM ".DB_PREPEND."phpwcms_article WHERE article_public=1 AND article_aktiv=1 AND article_nositemap=1;";

Update google sitemap

Posted: Thu 5. Jan 2006, 00:02
by markoehl
Thanx Mate
great feedback. I implemented this new code and added also the gss files. Looks much better now!!

Get the new Files http://www.pagewerkstatt.ch/phpwcms_mod_sitemap.zip

Posted: Thu 5. Jan 2006, 16:38
by Glovebox
markoehl wrote:
Glovebox wrote:This doesnt support re-written urls?
As much I know rewritten urls works only for the structure. This scrpt is reading the content from phpwcms_article.. But I will have a closer look at that..
Thanks, please let us know.

Posted: Sat 14. Jan 2006, 13:27
by squidi
hi,

problem with a local installation ( xampplite - XJ! )

Code: Select all

Fatal error: URL http://localhost:8888/phpwcms/ not valid. Must be http[s]://[some.]domain.ext/ in C:\xampplite\htdocs\phpwcms\include\inc_lib\googleSitemap.inc.php on line 24
squidi

Posted: Sat 14. Jan 2006, 13:40
by markoehl
squidi wrote:hi,

problem with a local installation ( xampplite - XJ! )

Code: Select all

Fatal error: URL http://localhost:8888/phpwcms/ not valid. Must be http[s]://[some.]domain.ext/ in C:\xampplite\htdocs\phpwcms\include\inc_lib\googleSitemap.inc.php on line 24
squidi
To test with a local installation you have do replace code
if (!preg_match("/^https?:\/\/[a-z]([a-z0-9-.]+)+?.[a-z]+\/$/i", $strBaseURL))
{
trigger_error("URL {$strBaseURL} not valid. Must be http://[some.]domain.ext/", E_USER_ERROR);
}
else
{
$this->strBaseURL = $strBaseURL;
}

with
$this->strBaseURL = $strBaseURL;

Regards

Posted: Tue 14. Mar 2006, 10:53
by volkman
@arkon
I added

Code: Select all

AND article_deleted=0
in article.editcontent.inc.php on line 33 to avoid listing deleted articles in the sitemap

volkman

Posted: Tue 14. Mar 2006, 11:19
by markoehl
volkman wrote:@arkon
I added

Code: Select all

AND article_deleted=0
in article.editcontent.inc.php on line 33 to avoid listing deleted articles in the sitemap

volkman
Thanx. I modified the script too....

Alias ind sitemapfile

Posted: Tue 14. Mar 2006, 12:58
by volkman
I wanted the aliasname in the sitemapfile instead of /index.php?id=92,0,26,0....
So i modified the SQL-Statement in article.editcontent.inc.php. I am selecting fields from two tables (phpwcms_article and phpwcms_articlecat). If article_cid (from phpwcms_article) and acat_id (from phpwcms_articlecat) are the same fetch the acat_alias, thats it.

Code: Select all

$sql = "SELECT acat_id, acat_alias, article_cid, date_format(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date ";
$sql .= "FROM ".DB_PREPEND."phpwcms_articlecat, phpwcms_article WHERE (acat_id = article_cid) AND article_public=1 AND article_aktiv=1 AND article_nositemap=1 AND article_deleted=0;"; 
if($result = mysql_query($sql, $db)) {
	while($row = mysql_fetch_row($result)) {
		$oSitemap->addEntry(
			array('loc' => 'index.php?'.$row[1].'',
				'lastmod' => $row[3],
				'changefreq' => 'monthly',
				'priority' => '0.8'));
	}
	mysql_free_result($result);
}
We only need $row[1] (the alias) and $row[3] (date of modification).

After editing the file the map looks like this:

Code: Select all

<loc>http://www.yourdomain.de/index.php?sitemap</loc>
<lastmod>2006-03-05T18:15:30+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>http://www.yourdomain.de/index.php?kompetenznetz</loc>
<lastmod>2006-03-14T10:07:21+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>http://www.yourdomain.de/index.php?patient</loc>
<lastmod>2006-03-05T16:33:36+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
Hope that helps,

volkman