Page 3 of 4
Re: Google Sitemaps generator
Posted: Thu Apr 06, 2006 11:19 am
by Russ
Hi lennon, I've now had chance to put it up on our test site (excactly as written above - no you don't need to change anything) and it seems to be OK?
http://www.cms.shoesforindustry.net/sitemap.php
UPDATE: I should point out that hidden pages don't show.
In the test above you don't see hiddenpage.html but it is there
http://www.cms.shoesforindustry.net/tes ... npage.html
Not sure how I test if this is valid, but I guess there are those out there who do?
Could you ket us know
Russ
Re: Google Sitemaps generator
Posted: Thu Apr 06, 2006 11:34 am
by lennon
When i go to mysite.php i get an fatal error on line 4.
any ideas?
Re: Google Sitemaps generator
Posted: Thu Apr 06, 2006 11:38 am
by Russ
Hi lennon, did you have clean url's before adding the site map?
Can you post a link?
Russ
Re: Google Sitemaps generator
Posted: Thu Apr 06, 2006 11:44 am
by lennon
Re: Google Sitemaps generator
Posted: Thu Apr 06, 2006 11:56 am
by Russ
I don't think it can find your include.php file and so can't access it's variables. I could be wrong however.
What version of CMS are you using? Our test site is 'Savusavu' 0.12.1 so it could be the version?
Try changing...
Code: Select all
require_once(dirname(__FILE__)."/include.php");
to
Hope this helps
Russ
P.S. Nice speedy site by the way

Re: Google Sitemaps generator
Posted: Thu Apr 06, 2006 12:02 pm
by lennon
Thanks russ.
Thats made no difference. Might be version issue. Think I'm one behind.
I'll give that a go....
Re: Google Sitemaps generator
Posted: Thu Apr 06, 2006 12:42 pm
by Russ
Let me know
Russ
Re: Google Sitemaps generator
Posted: Thu Apr 06, 2006 4:15 pm
by lennon
Russ,
I tried to use the code that tamlyn attached before I did an upgrade. That worked a treat.
Thanks for all the help.
Re: Google Sitemaps generator
Posted: Thu Apr 06, 2006 10:16 pm
by CMSMS-Fan
Russ,
Thanks for the above but maybe I missed something and all mine does is produce clean file names ie
http://www.hit.uk.net/Home.html but Home does not exist as a file it would be
http://www.hit.uk.net/Home.html (
http://www.hit.uk.net/index.php?home) I appreciate there must be a setting somewhere to change this but where?
Re: Google Sitemaps generator
Posted: Fri Apr 07, 2006 8:49 am
by Russ
Hello HuttonIT! I think perhaps you have the wrong end of the stick. I had a quick look at your site and you are not using clean url's, as you point out you use 'index.php?home' rather than 'home.html. For you to use this adapted Google sitemap, you would need to first convert your site to clean url's and then use this modification. (Have a search in the CMS forum on how to do this.) My mod only works for sites which have and also set Page Alias's on all their pages. Hence my mention of the settings in config, (although it appears defaulting a Page Alias does not work in the current version.)
If you don't want to change anything then use the Piratos's inspired original version which supports the way you pages currently work.
Hope this helps
Russ
Re: Google Sitemaps generator
Posted: Fri Apr 07, 2006 10:28 am
by CMSMS-Fan
Thanks Russ I thought that I was going mad. It would be nice to have the choice in the admin panel under Glogal Settings to either use clean Url's or not.
I see there is a hack but a built in module may be better as a hack would be cleared out each time an update is published.
Re: Google Sitemaps generator
Posted: Fri Apr 07, 2006 11:03 am
by Russ
Actually the 'hack' (.htaccess) and config.php stays in place - or at least has done throughout my upgrades? I'm talking about standard clean url's here,
domain.com/home.html
Where every page is off the root, see our test site for an example
http://www.cms.shoesforindustry.net/home.html
If you want subsections like:
domain.com/products/product1.html
then this is more complex and, to be honest, breaks a lot of things so maybe you would have to wait untill this can be put in the core. For more info:
http://forum.cmsmadesimple.org/index.ph ... 5.msg22365
Hope this helps
Russ
Re: Google Sitemaps generator
Posted: Fri Apr 07, 2006 5:55 pm
by CMSMS-Fan
Thanks Russ I am away for a week so will look at it when I get home.
I must admit clean URLs does look a lot cleaner too.
One question though-will the old links still work i.e.
www.domain/index.php?page=home etc... ? It's just that Google and M S N already have two of my sites indexed and if I change things they will get 404 errors. But I suppose in the long run I may just have to live with that and edit my 404 to lonk them to the domain root again.
Re: Google Sitemaps generator
Posted: Sat Apr 08, 2006 6:34 am
by Russ
Yes I beleive the old links should work, several modules won't use the clean url's and they seem to work.
Russ
Re: Google Sitemaps generator
Posted: Wed Apr 12, 2006 11:59 am
by PePiPoo
tsw wrote:
One FR from here too
menu links pointing to different servers isnt allowed..
still great script
I had Google complaining about this for my sitemap as well, so I added in an additional check before the point where the script writes a URL:
Code: Select all
if ( strpos($onecontent->GetURL(), $gCms->config['root_url'] ) === false )
{
continue;
}
The full version I'm using is shown below, and the sitemap it produces now validates OK with Google:
Code: Select all
<?php
#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#This project's homepage is: http://cmsmadesimple.sf.net
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#$Id: preview.php 2148 2005-11-09 20:44:15Z wishy $
require_once(dirname(__FILE__)."/include.php");
header("Content-Type: application/xml");
echo '<?xml version="1.0" encoding="UTF-8"?>'. "\n";
echo '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">'. "\n";
$allcontent = ContentManager::GetAllContent();
$maxdepth = 3;
foreach ($allcontent as $onecontent)
{
$depth = count(split('\.', $onecontent->Hierarchy()));
if($maxdepth < $depth)
$maxdepth = $depth;
}
foreach ($allcontent as $onecontent)
{
$depth = count(split('\.', $onecontent->Hierarchy()));
//$rel = 1 - ($depth-1) / ($maxdepth);
$rel = 0.7 / $depth;
$rel = number_format($rel, 1, '.', '');
if($oneconetn->default_content)
$rel = 1;
if (!$onecontent->Active())
{
continue;
}
if ($onecontent->Type() == 'separator')
{
continue;
}
if ($onecontent->Type() == 'sectionheader')
{
continue;
}
if ( strpos($onecontent->GetURL(), $gCms->config['root_url'] ) === false )
{
continue;
}
$date = $onecontent->mModifiedDate;
$datepart = explode(" ", $date);
$date = $datepart[0];
$time = $datepart[1];
//setting time-zone statically
$TZD = "+01:00";
$datetime = implode("T",$datepart);
$googledatetime = $datetime.$TZD;
echo ' <url> ' . "\n";
echo ' <loc>' . $onecontent->GetURL() . '</loc>'. "\n";
echo ' <lastmod>' . $googledatetime . '</lastmod>'. "\n";
echo ' <priority>' . $rel . '</priority>'. "\n";
// Perhaps: generate a changefreq param of $onconent->Cachable()
echo ' </url> '. "\n";
}
echo ' </urlset>'. "\n";
?>