Page 2 of 4
Re: Google Sitemaps generator
Posted: Sat Mar 25, 2006 9:50 am
by tsw
One FR from here too
menu links pointing to different servers isnt allowed..
still great script
Re: Google Sitemaps generator
Posted: Mon Mar 27, 2006 8:52 am
by fredt
I managed to add a "Shown only Pages",
Code: Select all
if (!$onecontent->Active())
{
continue;
}
//MODIF - ADDED
if (!$onecontent->ShowInMenu())
{
continue;
}
... can someone help with the News... I'd really like tell Google I've just added or updated some news...
Re: Google Sitemaps generator
Posted: Mon Apr 03, 2006 2:56 pm
by leMich
Help, Google Sitemaps tells me "fileformat unsupported". Why ? I tried to uncomment the XMLNS line but i doesn't work.
Re: Google Sitemaps generator
Posted: Tue Apr 04, 2006 4:31 pm
by CMSMS-Fan
Same here zlinky. Can anyone post a working and supported version of the sitemap.php?
Re: Google Sitemaps generator
Posted: Tue Apr 04, 2006 4:41 pm
by tamlyn
This works well for me.
[attachment deleted by admin]
Re: Google Sitemaps generator
Posted: Tue Apr 04, 2006 9:17 pm
by CMSMS-Fan
Yes it works but have you noticed that Google keeps showing it as
"Unsupported file format". This may be fine but if it is not supported then it will not be searched by 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"
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";
*/
echo '<urlset>' . "\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;
}
$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";
?>
Saved as sitemap.php simply shows up as
"Unsupported file format"?
If you uncomment the
Code: Select all
echo '<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";
All you get is the error:-
Code: Select all
XML Parsing Error: no element found
Location: http://www.uvc-cog.org.uk/sitemap.php
Line Number 110, Column 1:
Re: Google Sitemaps generator
Posted: Wed Apr 05, 2006 4:58 am
by badhoy
Interesting. It was working fine for me a couple of weeks back. Anyone have any idea how to fix this problem with the "Unsupported file format"?
Re: Google Sitemaps generator
Posted: Wed Apr 05, 2006 9:48 am
by Piratos
Here
http://forum.cmsmadesimple.org/index.ph ... 895.0.html
you can copy my very small script - it works fine for me and others.
Re: Google Sitemaps generator
Posted: Wed Apr 05, 2006 1:55 pm
by tamlyn
HuttonIT wrote:
Yes it works but have you noticed that Google keeps showing it as "Unsupported file format". This may be fine but if it is not supported then it will not be searched by Google....
No, it actually works for me - "Sitemap status: OK". Did you try the code I attached? It differs from the one you pasted in that the xml namespaces in the have been commented back in.
Re: Google Sitemaps generator
Posted: Wed Apr 05, 2006 3:00 pm
by badhoy
I used you file tamlyn and it works now. Thanks.
Re: Google Sitemaps generator
Posted: Wed Apr 05, 2006 5:49 pm
by Russ
I was looking at Piratos's version of the Google sitemap generator and thought it was very good!
However I wonder if it would be even better to give Google the 'clean' url's rather than the 'index.php?page=2'??
Now I don't know what Google is expecting. but it strikes me 'clean' url's could be an option? I havn't tested the solution below - it validates as xml but that's it.
Basically if you are already using and seeing 'clean ur;s' ignore the next bit in curly brackets
{This uses the 'content alias' field - so you have to have them set or perhaps set
Code: Select all
$config['auto_alias_content'] = true;
in the config.php file - you'll also need mod rewrite and the appropriate settings.
Code: Select all
$config['assume_mod_rewrite'] = true;
}
I'll leave others to test and let everyone know if it works or not
Code: Select all
<?php
require_once(dirname(__FILE__)."/include.php");
global $gCms;
$db =$gCms->GetDb();
$dbresult = $db->Execute("SELECT c.content_id,c.content_alias,c.type,c.modified_date,c.show_in_menu FROM ".cms_db_prefix()."content c INNER JOIN ".cms_db_prefix()."content_props p ON p.content_id = c.content_id WHERE (c.content_id = p.content_id AND c.active = 1 AND c.type='content' AND c.show_in_menu =1)");
$out='<?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">'."\n";
if ($dbresult)
{
while ($dbr = $dbresult->FetchRow())
{
$d = explode(" ", $dbr['modified_date']);
$date = $d[0];
$time = $d[1];
$datetime = implode("T",$d);
$out
.="<url><loc>".$config['root_url']."/".$dbr['content_alias'].$config['page_extension']."</loc><lastmod>"
.$datetime."+00:00</lastmod><priority>0.5</priority></url>"."\n";
}
}
$out .="</urlset>";
header("Content-Type: application/xml");
echo $out;
?>
Save it as sitemap.php in the root of your web site and let us all know how you get on.
Russ
Re: Google Sitemaps generator
Posted: Thu Apr 06, 2006 10:17 am
by lennon
sorry basic question here:
require_once(dirname(__FILE__)
Does this need to be like this? mysite.com(database_name)
Or do i leave it as is. Sorry if this is stupid....
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