PDA

View Full Version : sitemap XML problem


chatfan
03-03-2007, 11:04 PM
Getting this weird error:

Fatal error: Class 'vivvo_output' not found in /public_html/plugins/sitemap/Sitemap.class.php on line 13


Anyone any idea how to fix this?

chatfan
03-05-2007, 09:51 PM
anyone? yes? no? maybe?

So anyway.... maybe I can edit post sin this forum?

plane
03-07-2007, 03:49 AM
Getting this weird error:

Fatal error: Class 'vivvo_output' not found in /public_html/plugins/sitemap/Sitemap.class.php on line 13


Anyone any idea how to fix this?

why no answer?

Alex
03-07-2007, 03:42 PM
The user didn't submit FTP access to his site, so we really can't see what the problem might be.

plane
03-08-2007, 08:52 AM
The user didn't submit FTP access to his site, so we really can't see what the problem might be.

:) I see, thank you!

chatfan
03-08-2007, 04:01 PM
I guess i'm used to a different community structure where we try to solve problems outside of the support ticket system. Not sure why nobody replied to this and its assumed obvious I should have submitted a ticket.

You seem to have the same problem on your demo site (http://www.myvivvo.com/sitemap.xml):
http://www.myvivvo.com/sitemap.xml

Fatal error: Class vivvo_google_site_map: Cannot inherit from undefined class vivvo_output in /home/spoonla1/public_html/myvivvo/plugins/sitemap/Sitemap.class.php on line 13

So i figured someone must have had this problem before and fixed it :)

If this problem persists I'll sub mit a trouble ticket next week, right now i'm betting it can be solves through the forum. Helping others in the future at the same time.

shketuljko
03-09-2007, 09:16 AM
Replace code in this file VIVVO_ROOT/plugins/sitemap/Sitemap.class.php
with this code:



<?php

require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR .
'..' . DIRECTORY_SEPARATOR . 'Class' . DIRECTORY_SEPARATOR . 'Article.class.php');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR .
'..' . DIRECTORY_SEPARATOR . 'Class' . DIRECTORY_SEPARATOR . 'Category.class.php');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR .
'..' . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'conf.php');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR .
'..' . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'config.php');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR .
'..' . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'db_conn.php');

define('WP_SHOW_FRIENDLY_URL', $showFriendlyURL);
define('WP_SHOW_AUTHOR_INFO', $show_author_info);
define('WP_URL', $url);

class vivvo_google_site_map{
var $_category;

function set_category(){
$query="SELECT c.id, MAX(a.created) AS lastmod FROM tblCategories AS c LEFT JOIN tblArticles AS a ON a.category_id = c.id GROUP BY c.id ORDER BY c.order_num";
$result=mysql_query($query) or sql_error ($query, "category");
if (mysql_num_rows($result)==0) return false;
while ($row = mysql_fetch_array($result)){
$this->_category[$row['id']] = array();
$this->_category[$row['id']]['lastmod'] = $row['lastmod'];
$this->_category[$row['id']]['loc'] = Category::HTML_show_friendly_cat($row['id']);
}
}

function author_sitemap(){
$author_sitemap ='';
if (WP_SHOW_AUTHOR_INFO == 'Yes'){
$query="SELECT au.username, MAX(a.created) AS lastmod FROM tblUsers AS au LEFT JOIN tblArticles AS a ON a.author = au.username GROUP BY au.username ORDER BY au.username";
$result=mysql_query($query) or sql_error ($query, "author");
if (mysql_num_rows($result) == 0) return '';
while ($row = mysql_fetch_array($result)){
if (WP_SHOW_FRIENDLY_URL != "no") {
$author_sitemap .= $this->format_xml(WP_URL . 'author/' . urldecode($row['username']) . '.html', $row['lasmod']);
}else{
$author_sitemap .= $this->format_xml(WP_URL . 'index.php?author=' . urldecode($row['username']), $row['lasmod']);
}
}
}
return $author_sitemap;
}

function category_sitemap(){
if (is_array($this->_category)){
$category_sitemap = '';
foreach ($this->_category as $cat) {
if (!(strstr($cat['loc'], 'index.php?') === false)) {
$category_sitemap .= $this->format_xml($cat['loc'], $cat['lastmod']);
}
}
return $category_sitemap;
}
return false;
}

function article_sitemap(){
if (is_array($this->_category)){
$article_sitemap = '';

$query="SELECT id, category_id, created, SEfriendly FROM tblArticles ORDER BY created";
$result=mysql_query($query) or sql_error ($query, "category");
if (mysql_num_rows($result)==0) return false;
while ($row = mysql_fetch_array($result)){
$article_sitemap .= $this->format_xml(Article::HTML_show_friendly_url($row['id'],'',$this->_category[$row['category_id']]['loc'],$row['SEfriendly']),$row['created']);
}
return $article_sitemap;
}
return false;
}

function format_xml($loc, $lastmod = ''){
$time = strtotime($lastmod);

$lastmodDate = date('Y-m-d',$time);
$lastmodTime = date('H:i:s',$time);
$lastmodZone = str_replace(substr(date('O',$time), 0, 3),substr(date('O',$time), 0, 3).':',date('O',$time));

$lastmod = $lastmodDate . 'T' . $lastmodTime . $lastmodZone;

$xml = "\t<url>\n";
$xml .= "\t\t<loc>$loc</loc>\n";
$xml .= "\t\t<lastmod>$lastmod</lastmod>\n";
$xml .= "\t</url>\n";
return $xml;
}

function get_sitemap(){
$sitemap = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">\n";
$sitemap .= $this->author_sitemap();
$sitemap .= $this->category_sitemap();
$sitemap .= $this->article_sitemap();
$sitemap .="</urlset>";
return $sitemap;
}

function vivvo_google_site_map(){
$this->set_category();
}
}

?>




and replace code in this file VIVVO_ROOT/plugins/sitemap/index.php
with this code:



<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Sitemap.class.php');
header("Content-type: text/xml; charset=utf-8");
$sitemap = new vivvo_google_site_map();
echo $sitemap->get_sitemap();
?>

chatfan
03-10-2007, 05:50 PM
Tried it, seems to be working. thanks!