You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
That worked perfect! Thank you Dave!
This is going to save me soo much time. No longer having to crawl the site and generate a new site map every time a new category or product is added. Which is every week, these days. Awesome to hear this is going into the next generation of software.
Offline
Lisa, when did you hear this was going to be in the next generation? I didn't see that mentioned?
Regards,
James...
Offline
I used this bit of code to generate the sitemap and modded it to generate the Google Base code. Works like a charm. If anyone needs the codes in full, let me know and I will add the code here.
Offline
Hi,
So I tried this and get a
XML Parsing Error: not well-formed
Location: http://www.west4.info/sitemap.xml
Line Number 1228, Column 11:
</urlset></urlset>
----------^
when i check it with google.
anyone recognise this error or no how to view the sitemap.xml as it doesnt seem to create it.
To check i renamed the existing sitemap.xml file and ran the script again still get the error but no sitemap is created....
Cheers,
Bruce.
Offline
You will see from the code above that, yourtags go :
</urlset> </urlset>
It should be
<urlset> your other tags etc .... </urlset>
Last edited by webdev1234 (07-17-2008 11:10:21)
Offline
Hi,
Cheers, I had closed </urlset> twice. I think it works now.
Oh... Is this what it's supposed to look like? wwwwest4.info/sitemap.xml
Thanks.
Bruce.
Last edited by west4 (07-18-2008 08:13:39)
Offline
Hi,
I would like to use this sitemap tool, but as I'm not an expert on this issue, I'm confused about how to use it.
Where do I have to put config.php and sitemap.php? under the "khxc-private" folder, I already have a config.php, so I guess it is not a correct place to put them.
Once I have put those 2 php files in the correct folders, what else do I have to do in order to generate the sitemap.xml?
what will be the sitemap file that I have to inform to google?
the sitemap will be updating automatically when the website has been changed or I need to do it everytime that I make changes on my website? which implies everyday in my case, because I'm making an update of my products daily.
thanks in advance for help me
Evelyn
Offline
If you're using the US version of CCP it would be much easier for you to purchase and installed the SiteMap XMOD which will do everything you need.
Offline
About sitemap XMOD:
1) would it improve the number of visitors to my website?
2) I'm updating daily my website with products, do I need to do something special with the sitemap in order to maintain it updated?
3) is it complicated to install?
Thanks
E.
Offline
evelyn wrote:
1) would it improve the number of visitors to my website?
Nothing can claim to do that with certainty.
evelyn wrote:
2) I'm updating daily my website with products, do I need to do something special with the sitemap in order to maintain it updated?
No.
evelyn wrote:
3) is it complicated to install?
No, you simply have to run the CCP installer after purchasing the XMOD.
Take a look at the to decide if it's right for you.
Offline
You must be referring to something that isn't part of CCP John. There is nothing "crocked" with the SiteMap XMOD and not a single bit of code within CCP has ever used php short tags. The Google Webmaster Tools shouldn't be pointing to a php file anyway. The XMOD produces the XML file which is what Google expects.
Offline
Again, this is not something supplied by Kryptronic or available for CCP so most of us would simply be stabbing in the dark John. An external script would have no knowledge of nor make any use of CCP specific functions or routines. Based on the snippet you posted above in post 38 it would appear that everything is being done without regard to CCP at all.
Offline
I have now got this script working. - Thank-you, Perkster [and Dave for additional input (the original script prodshow code did not work with my store/database)].
On the time side of things it is important that there is a minus or a plus sign (so the -08:00 in the script needs to be +00:00) if you are a UK CCP user (until we hit British Summer time again, anyway ).
Be careful with the generator values for your category and product listings. Those given in the script are not true for the default UK cart setup and will probably need to be changed to something more like those shown below (note the and - they are the important part if you are not to end up with invalid (and non-indexable) links in your sitemap):
//your url-product as we worked out in #4 $url_product = 'http://www.litez.co.uk/gbu0-prodshow/'.mysql_result($result,$i,"id");
//your url-product as we worked out in #4 $url_cat = 'http://www.litez.co.uk/gbu0-catshow/'.mysql_result($result1,$i,"id");
For, the config.php (or whatever you have called it - does not need to be called config.php) the <? at the beginning of the script needs to be changed to <?php or Google will reject your sitemap without even bothering to look at the rest of it! Ideally it should be located below your web directory (so if the path to your web directory is /home/htdocs/ the file would need to go in the /home/ directory - the /htdocs/ directory!):
include '/home/config.php';
The permissions for both files also need to match up. If, for security reasons, you make both files owned by root with group ownership by your webserver group (apache, litespeed, whatever) you would need to make sure that the ownership is set correctly on both, with 444 file permission on the sitemap.php and 440 on the config.php. - This does work, and will also work with the following Apache directives in place:
<Directory /> Order deny,allow deny from all </Directory> <Directory /web> Order allow,deny allow from all </Directory>
The above directives are used to make directory traversal attacks more difficult (lookup apache order directive for more information on using these), but are otherwise not essential to being able to use the sitemap script.
Also, if Google has your domain access as not being prefixed by www (ie: http://somesite.tld) you will need to ensure that all references in the script are amended accordingly and also that database references to in the script are changed to .
Don't forget that errors displayed by Google will match the contents of the sitemap script. - This is because the script is used to generate a virtual sitemap, so tracking down errors involves going into the script and locating the code that is used to generate whatever is causing the error.
Finally, the script shown below is how my (working) script looks (modified at the top for security, of course ). In both Firefox and IE the sitemap.php should display in the browser as a list of entries tagged with tags like <url>, <loc>, <lastmod>, etc..
<?php include '/home/config.php'; header("Content-Type: text/xml;charset=iso-8859-1"); //connect to the database mysql_connect("$s","$u","$p"); @mysql_select_db("$d") or die("Unable to select DB"); //count all the articles that are current and published $num_rows = mysql_num_rows(mysql_query("select * from gbu0_prod")); //select them and put them into a dataset called $result $query = "select * from gbu0_prod ORDER BY id DESC" ; $result = mysql_query($query) or die("Query failed"); //count all the articles that are current and published $num_rows1 = mysql_num_rows(mysql_query("select * from gbu0_cat")); //select them and put them into a dataset called $result $query = "select * from gbu0_cat ORDER BY id DESC" ; $result1 = mysql_query($query) or die("Query failed"); //this is the normal header applied to any Google sitemap.xml file echo '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; //this code makes more sense in step #5 $url_product = 'http://litez.co.uk/gbu0-prodshow'.urlencode(mysql_result($result,$i,"id")); //loop through the entire resultset for($i=0;$i<$num_rows; $i++) { //your url-product as we worked out in #4 $url_product = 'http://litez.co.uk/gbu0-prodshow/'.mysql_result($result,$i,"id"); /*you need to assign a date to the entity. if you don't store a timestamp in the Database then you need slapping*/ $date = gmdate("Y m d H:i:s"); $year = substr($date,0,4); //work out the year $mon = substr($date,5,2); //work out the month $day = substr($date,8,2); //work out the day $hrs = substr($date,11,2); $min = substr($date,14,2); $sec = substr($date,17,2); /*display the date in the format Google expects: 2006-01-29T18:00:00 for example*/ $displaydate = ''.$year.'-'.$mon.'-'.$day.'T'.$hrs.':'.$min.':'.$sec.''; //you can assign whatever changefreq and priority you like echo ' <url> <loc>'.$url_product.'.html</loc> <lastmod>'.$displaydate.'+00:00</lastmod> <changefreq>daily</changefreq> <priority>0.5</priority> </url> '; } //loop through the entire resultset for($i=0;$i<$num_rows1; $i++) { //your url-product as we worked out in #4 $url_cat = 'http://litez.co.uk/gbu0-catshow/'.mysql_result($result1,$i,"id"); /*you need to assign a date to the entity. if you don't store a timestamp in the Database then you need slapping*/ $date = gmdate("Y m d H:i:s"); $year = substr($date,0,4); //work out the year $mon = substr($date,5,2); //work out the month $day = substr($date,8,2); //work out the day $hrs = substr($date,11,2); $min = substr($date,14,2); $sec = substr($date,17,2); /*display the date in the format Google expects: 2006-01-29T18:00:00 for example*/ $displaydate = ''.$year.'-'.$mon.'-'.$day.'T'.$hrs.':'.$min.':'.$sec.''; //you can assign whatever changefreq and priority you like echo ' <url> <loc>'.$url_cat.'.html</loc> <lastmod>'.$displaydate.'+00:00</lastmod> <changefreq>daily</changefreq> <priority>0.5</priority> </url> '; } mysql_close(); //close connection //close the XML attribute that we opened in #3 echo '</urlset>'; // ob_end_flush(); ?>
Last edited by Design_Wholesale (01-20-2010 17:54:09)
Offline