Recent Topics

1 Jul 26, 2008 13:08    

[v 1.9-1.1]
I am interested in downloading the site map generator plugin for a 1.9-10 version which is described here:

http://manual.b2evolution.net/Sitemap_plugin

The sitemap plugin is discussed in detail there (and in forum posts), but I cannot find where the code is located. There must be a plugins download page on the site that I am missing. I would sure appreciate a link.

3 Jul 26, 2008 14:57

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?

4 Jul 26, 2008 15:04

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();

5 Jul 26, 2008 15:05

Thanks a million sam2kb. You are both a gentleman and a scholar!

6 Jul 26, 2008 15:06

Make sure it works because I didn't try it :p

7 Jul 26, 2008 15:31

I'm getting an error:

Parse error: syntax error, unexpected T_STRING in on line 10

8 Jul 26, 2008 15:34

Change it to

echo '<?xml version="1.0" encoding="UTF-8" ?>';

9 Jul 26, 2008 21:35

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

10 Jul 27, 2008 03:19

Seems like PHP reads ?> as a closing tag.
Try to remove the space

echo '<?xml version="1.0" encoding="UTF-8"?>';

12 Jul 27, 2008 07:35

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?

13 Jul 27, 2008 07:45

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.'>';

14 Jul 27, 2008 07:53

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.


Form is loading...