2 tilqicom Jul 26, 2008 14:44

Thanks for the links.. but no sitemap plugin can be found in either location.
On the following page on the B2 site (here) there is one called Advanced Google Sitemap, but it has a dead link:
http://plugins.b2evolution.net/index.php?cat=22 (has sitemap plugin description, but with dead link)
The sourceforge.net site does have some plugins located here, but no sitemap plugin:
http://sourceforge.net/project/showfiles.php?group_id=160495 (no sitemap plugin on the list).
Anyone else have any ideas where I might find it?
Here you go ;)
Save the code as skins/_sitemap/_main.php
Call it as a tempskin index.php?blog=2&tempskin=_sitemap
/**
* This template generates a sitemap feed for the requested blog's latest posts
*/
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
// Note: since URLs are likely to be clean ASCII, $io_charset can probably be faked to UTF-8 here
header( 'Content-type: application/xml; charset=UTF-8' );
echo '<?xml version="1.0" encoding="UTF-8"?'.'>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
while( $Item = & $MainList->get_item() )
{ // For each blog post, do everything below up to the closing curly brace "}"
?>
<url>
<loc><?php $Item->permanent_url( 'single' ) ?></loc>
<lastmod><?php $Item->mod_date( 'isoZ', true ) ?></lastmod>
<priority>0.9</priority>
</url>
<?php
}
echo '</urlset>';
$Hit->log(); // log the hit on this page
// This is a self contained XML document, make sure there is no additional output:
exit();
Thanks a million sam2kb. You are both a gentleman and a scholar!
Make sure it works because I didn't try it :p
I'm getting an error:
Parse error: syntax error, unexpected T_STRING in on line 10
Change it to
echo '<?xml version="1.0" encoding="UTF-8" ?>';
Followed all instructions.... still getting the error
1. I made the code changes.
3. I created a new directory in the skins directory called _sitemap
3. I saved the code as skins/_sitemap/_main.php
4. I called it as a tempskin with .../blogs/index.php?blog=2&tempskin=_sitemap
5. I get this error;
Parse error: syntax error, unexpected T_STRING in /home/mysite/public_html/blogtest/b2evolution/blogs/skins/_sitemap/_main.php on line 10
Seems like PHP reads ?> as a closing tag.
Try to remove the space
echo '<?xml version="1.0" encoding="UTF-8"?>';
Freak error, but sam2kb, you are right with your solution. I found this page: http://forums.digitalpoint.com/showthread.php?t=260455
Good luck
I tried that... but it still produces the same error.
Parse error: syntax error, unexpected T_STRING in /home/mysite/public_html/blogtest/b2evolution/blogs/skins/_sitemap/_main.php on line 10
Following, at the end of the post, is the code I have saved as the _main.php file in the skins directory entitled _sitemap. I don't have this any other location. Should I?
That error comes when I type (paste) into my browers this url:
foobardotcom/blogtest/b2evolution/blogs/index.php?blog=2&tempskin=_sitemap
/**
* This template generates a sitemap feed for the requested blog's latest posts
*/
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
// Note: since URLs are likely to be clean ASCII, $io_charset can probably be faked to UTF-8 here
header( 'Content-type: application/xml; charset=UTF-8' );
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
while( $Item = & $MainList->get_item() )
{ // For each blog post, do everything below up to the closing curly brace "}"
?>
<url>
<loc><?php $Item->permanent_url( 'single' ) ?></loc>
<lastmod><?php $Item->mod_date( 'isoZ', true ) ?></lastmod>
<priority>0.9</priority>
</url>
<?php
}
echo '</urlset>';
$Hit->log(); // log the hit on this page
// This is a self contained XML document, make sure there is no additional output:
exit();
Am I overlooking something obvious?
Did you also put <?php tag before the code and ?> after?
<?php
THE CODE FROM PREVIOUS POST
?>
If you did then try this solution.
$questionmark = '?';
echo '<'.$questionmark.'xml version="1.0" encoding="UTF-8"'.$questionmark.'>';
That worked!! Thanks. I am embarrassed to say that I did not put the <?php tag before the code and ?> after. You know, I just assumed it was there and never looked... (I'm too much of a copy and paste kind of guy).
But, all's well that ends well and this is a very nice solution. Thanks again for all your kind help.
No problem
http://sourceforge.net/projects/evocms-plugins/
http://plugins.b2evolution.net/
hope this helps