Topic: Support/Comments for sitemap  (Read 71205 times)

Pages: 1 ... 4 5 [6] 7 8 ... 11   Go Down

#101: 25-Feb-2008, 04:02 AM

bertcatsburg
Posts: 83

Hello,
Maybe Wayfinder can do that too.
But we are talking about a Sitemap here.
Did you use Wayfinder to create a sitemap?

#102: 25-Feb-2008, 04:05 AM

Testers
ncrossland
Posts: 241

No, but if I wanted to create one using UL/LI structure, with multilevels and in menu order, I'd use it -- since that's exactly what it produces by default.
Author: ManagerManager plugin - customise your ModX manager interface

#103: 3-Mar-2008, 10:07 AM


fruitwerks
Posts: 382

tacos are yummy!

I glanced at all the posts in this thread, but I may have missed it...

All I get when I go to my sitemap page is...

Code:

<urlset xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">

<url>
<loc>http://sweetskies.fruitwerks.us/index.php</loc>
<lastmod>2008-02-28</lastmod>
</url>
</urlset>

Plenty of pages in this site Smiley

Modx 0.9.6
SiteMap 1.0.6

#104: 3-Mar-2008, 10:58 AM

Testers
ncrossland
Posts: 241

What is your sitemap call - just [[Sitemap]]  or any parameters?
Author: ManagerManager plugin - customise your ModX manager interface

#105: 3-Mar-2008, 11:31 AM


fruitwerks
Posts: 382

tacos are yummy!

Code:
[[sitemap? &format=`sp`]]

snippet is named sitemap.. would that make a difference? I don't know if it calls back on itself somewhere.

tried cached / uncached, cleared cache... same results. The document is setup correctly, blank template, text/xml. Not too bothered, I had a website make my map for me and I edited it by hand, then uploaded it to the server for google. But we like when things work so *big hmm*

*shrug*

#106: 11-Mar-2008, 11:41 AM


rossco
Posts: 927

WWW
Can someone help out with styling the feed?  I have the xml running correctly but I want to make it more readable to someone and use it as a sitemap on my website.  The xml is setup correctly, i just want to style it now.  I've tried understanding the xsl but It isn't syling anything.  Could someone help out?

#107: 20-Mar-2008, 10:29 AM

bertcatsburg
Posts: 83

Hello Rossco,

Did you find a solution yet?

XSL might be a solution. Your XSL converts the XML to HTML and includes CSS and/or Style attributes.
Another option would be to change the snippet itself and do it all in there. It fairly straightforward. I created a UL/IL construction in it, which was easy enough. Best option might be to do some sort of templating in the sitemap. So, every entry goes through a template for markup and styling. But maybe that's reinventing the XSLT-wheel.

Regards,

Bert

#108: 20-Mar-2008, 10:32 AM

Testers
ncrossland
Posts: 241

Can someone help out with styling the feed?  I have the xml running correctly but I want to make it more readable to someone and use it as a sitemap on my website.  The xml is setup correctly, i just want to style it now.  I've tried understanding the xsl but It isn't syling anything.  Could someone help out?

For HTML output, the easiest solution would be to use Wayfinder, which is designed exactly for this.
Author: ManagerManager plugin - customise your ModX manager interface

#109: 21-Mar-2008, 11:11 AM

Moderators
Gust
Posts: 93

I love MODx!

Yesterday I've installed this snippet (version 1.0.6) on a MODx installation 0.9.6 without any problems. In fact, it worked so well that I've tried to install it on another site, which is running MODx 0.9.6.1 and only receiving this error:

« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »
 
PHP error debug
  Error:  Invalid argument supplied for foreach()   
  Error type/ Nr.:  Warning - 2   
  File:  /home/gucro/public_html/manager/includes/document.parser.class.inc.php(769) : eval()'d code   
  Line:  208   
 
Parser timing
  MySQL:  0.0611 s (353 Requests)
  PHP:  0.0561 s   
  Total:  0.1171 s   

Whatever I try, I don't get it to work on the second site (and thus on a MODx 0.9.6.1 installation)...

Any idea's?

#110: 21-Mar-2008, 02:16 PM

Testers
ncrossland
Posts: 241

Looks like it might be filtering out all the documents, but not dealing well with it -- this may help:

Directly below line 153
Code:
// filter out documents
try inserting the following:
Code:
$output = array();
Author: ManagerManager plugin - customise your ModX manager interface

#111: 22-Mar-2008, 01:47 AM

Moderators
Gust
Posts: 93

I love MODx!

Thanks for the reply...

Tried the solution of ncrossland. When I call the page with the snippet, I get the following XML-document:

Code:
  <?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 is better then the error I got before, but not the result I was hoping for, since there are no pages in this XML.

#112: 23-Mar-2008, 07:37 PM

picou
Posts: 1

Hello,
I have installed the the google site map that is explained in the wiki.
http://wiki.modxcms.com/index.php/SiteMap:_Google_sitemaps_in_MODx#What_is_the_purpose_of_sitemaps.3F
I am having this error when pointing to the sitemap.xml page

Erreur d'analyse XML : mal formé
Emplacement : http://www.relaispc.net/site/sitemap.xml
Numéro de ligne 142, Colonne 21 :            if (!o && d.getElementById) o=d.getElementById(id);

Could someone indicate me in the right direction.
Thanks
NP

#113: 23-Mar-2008, 08:09 PM

tkfm
Posts: 909

WWW
Use blank document template (an empty one).

#114: 26-Mar-2008, 04:05 AM

Testers
ncrossland
Posts: 241

Thanks for the reply...

Tried the solution of ncrossland. When I call the page with the snippet, I get the following XML-document:

Code:
  <?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 is better then the error I got before, but not the result I was hoping for, since there are no pages in this XML.

It isn't picking up any pages - what is the Sitemap call you are using? Have you set any templates or pages (via template variable) to be excluded? Are all your pages published?
Author: ManagerManager plugin - customise your ModX manager interface

#115: 26-Mar-2008, 05:02 AM

Moderators
Gust
Posts: 93

I love MODx!

The SiteMap-call I am using:   [!SiteMap!]
Just the basic snippet-call, so no TV's, templates,... should be excluded.

All the pages on my site are published, so the sitemap shouldn't be empty...

Thanks in advance!

#116: 31-Mar-2008, 08:06 AM

simonok
Posts: 173

I am an undercover genius

WWW
I`ve been using sitemap for a while now and for some reason its adding this

- <url>
  <loc>http://www.eshop600.co.uk//.html</loc>
  <lastmod>1969-12-31</lastmod>
  </url>

Google keeps throwing up an error becuase of the date, but I cant find the offending document anywhere?

Anyone got this or knows how to fix?
I made my first site with modx
------------------------
Shopping blog
Sky+ HD

#117: 31-Mar-2008, 08:17 AM

simonok
Posts: 173

I am an undercover genius

WWW
Also the weird thing is if I change it to output at txt the weird page dissapears, very odd
I made my first site with modx
------------------------
Shopping blog
Sky+ HD

#118: 11-Apr-2008, 06:16 AM

chrisandy
Posts: 202

WWW
Quote
But: With xsl the sitemap seems to be empty... (although the source contains the data, it is not rendered, and: "Number of sitemaps in this Google sitemap index: 0")

Anybody find a solution to this?

#119: 25-Apr-2008, 07:33 AM

Marketing & Design Team

davidm
MODx evangelist
Posts: 7,073

The best way to predict the future is to invent it

WWW
I don't seem to find any reference to this issue but I have followed the tuto to the letter and SiteMap 1.0.6 gives me an error :

Fatal error: Cannot redeclare gettv() (previously declared in /home/**********/public_html/manager/includes/document.parser.class.inc.php(769) : eval()'d code:232) in /home/**********/public_html/manager/includes/document.parser.class.inc.php(769) : eval()'d code on line 255

I found a reference to a similar issue with GetField, but I lack the skills to transpose this to SiteMap.

Anyone has an idea ?
.: nodeo.net : Pour un web libre, moderne et ouvert ! :: david-molliere.net : Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web :.

*** Forums modxcms.fr Participez à l'élaboration du site MODx francophone ! ***

! Nouveau !  En live, ne manquez pas les news de modxcms.fr sur Twitter   ! Nouveau !

MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.

Config : Apache 2.2.8 - MySQL 5.0.67 - PHP 5.2.8 | Debian 4.0 (Etch)

Réalisations sous MODx : | pargade-notaires.fr | soleil.info | gican.asso.fr | michelez-notaires.com | amadom.gerondicap.com | jocelyne-violet.net

#120: 28-Apr-2008, 03:12 AM

Testers
ncrossland
Posts: 241

I don't seem to find any reference to this issue but I have followed the tuto to the letter and SiteMap 1.0.6 gives me an error :

Fatal error: Cannot redeclare gettv() (previously declared in /home/**********/public_html/manager/includes/document.parser.class.inc.php(769) : eval()'d code:232) in /home/**********/public_html/manager/includes/document.parser.class.inc.php(769) : eval()'d code on line 255

I found a reference to a similar issue with GetField, but I lack the skills to transpose this to SiteMap.

Anyone has an idea ?

Can you try this amended version:

Code:
<?php
/*
==================================================
sitemap
==================================================

Outputs a machine readable site map for search
engines and robots. Supports the following
formats:

- Sitemap Protocol used by Google Sitemaps
  (http://www.google.com/webmasters/sitemaps/)

- URL list in text format
  (e.g. Yahoo! submission)

Author: Grzegorz Adamiak [grad]
Version: 1.0.6 @ 29-feb-2008
License: LGPL
MODx: 0.9.2.1, 0.9.6.1

History:
# 1.0.6
- Add optional parameter (excludeWeblinks) to exclude weblinks from the sitemap, since they often point to external
  sites (which don't belong on your sitemap), or redirecting to other internal pages (which are already
  in the sitemap). Google Webmaster Tools generates warnings for excessive redirects.
  Default is false - e.g. default behaviour remains unchanged.
# 1.0.5
- Modification about non searchable documents, as suggested by forum user JayBee
  (http://modxcms.com/forums/index.php/topic,5754.msg99895.html#msg99895)
# 1.0.4 (By Bert Catsburg, bert@catsburg.com)
- Added display option 'ulli'. 
  An <ul><li> list of all published documents.
# 1.0.3
- NC added ability to specify the XSL URL - you don't always need one and it 
  seems to create a lot of support confusion!
  It is now a parameter (&xsl=``) which can take either an alias or a doc ID
- Modifications suggested by forum users Grad and Picachu incorporated
  (http://modxcms.com/forums/index.php/topic,5754.60.html)
# 1.0.2
- Reworked fetching of template variable value to
  get INHERITED value.
# 1.0.1
- Reworked fetching of template variable value,
  now it gets computed value instead of nominal;
  however, still not the inherited value.
# 1.0
- First public release.

TODO:
- provide output for ROR
--------------------------------------------------
*/

/* Parameters
----------------------------------------------- */

# $startid [ int ]
# Id of the 'root' document from which the sitemap
# starts.
# Default: 0

$startid = (isset($startid)) ? $startid 0;

# $format [ sp | txt | ror ]
# Which format of sitemap to use:
# - sp <- Sitemap Protocol used by Google
# - txt <- text file with list of URLs
# TODO - ror <- Resource Of Resources
# Default: sp

$format = (isset($format) && ($format != 'ror')) ? $format 'sp';

# $priority [ str ]
# Name of TV which sets the relative priority of
# the document. If there is no such TV, this
# parameter will not be used.
# Default: sitemap_priority

$priority = (isset($priority)) ? $priority 'sitemap_priority';

# $changefreq [ str ]
# Name of TV which sets the change frequency. If
# there is no such TV this parameter will not be
# used.
# Default: sitemap_changefreq

$changefreq = (isset($changefreq)) ? $changefreq 'sitemap_changefreq';

# $excludeTemplates [ str ]
# Documents based on which templates should not be
# included in the sitemap. Comma separated list
# with names of templates.
# Default: empty

$excludeTemplates = (isset($excludeTemplates)) ? $excludeTemplates : array();

# $excludeTV [ str ]
# Name of TV (boolean type) which sets document
# exclusion form sitemap. If there is no such TV
# this parameter will not be used.
# Default: 'sitemap_exclude'

$excludeTV = (isset($excludeTV)) ? $excludeTV 'sitemap_exclude';

# $xsl [ str ] 
# URL to the XSL style sheet
# or
# $xsl [ int ]
# doc ID of the XSL style sheet

$xsl = (isset($xsl)) ? $xsl '';
if (
is_numeric($xsl)) { $xsl $modx->makeUrl($xsl); }


# $excludeWeblinks [ bool ]
# Should weblinks be excluded?
# You may not want to include links to external sites in your sitemap,
# and Google gives warnings about multiple redirects to pages 
# within your site.
# Default: false
$excludeWeblinks = (isset($excludeWeblinks)) ? $excludeWeblinks false;


/* End parameters
----------------------------------------------- */

# get list of documents
# ---------------------------------------------
$docs getDocs($modx,$startid,$priority,$changefreq,$excludeTV);

# filter out documents by template or TV
# ---------------------------------------------
// get all templates
$select $modx->db->select("id, templatename"$modx->getFullTableName('site_templates'));
while (
$query $modx->db->getRow($select))
{
$allTemplates[$query['id']] = $query['templatename'];
}

// get templates to exclude
if (!empty ($excludeTemplates))
{
$excludeTemplates explode(","$excludeTemplates);
// trim template names and remove empty ones (just in case)
foreach ($excludeTemplates as $template)
{
if (trim($template))
$excludeTemplates[] = trim($template);
// end foreach
}

// filter out documents
foreach ($docs as $doc)
{
if (!in_array($doc['template'], array_flip(array_intersect($allTemplates$excludeTemplates)))) {
if (!$doc[$excludeTV] && $doc['published'] && $doc['template']!=&& $doc['searchable']) {
if (!$excludeWeblinks || ($excludeWeblinks && $doc['type'] != 'reference')) {
$output[] = $doc;
}
}
}
}
$docs $output;
unset (
$output$allTemplates$excludeTemplates);

# build sitemap in specified format
# ---------------------------------------------

switch ($format)
{
// Next case added in version 1.0.4
case 'ulli'// UL List
$output .= "<ul class=\"sitemap\">\n";
// TODO: Sort the array on Menu Index
// TODO: Make a nested ul-li based on the levels in the document tree.
foreach ($docs as $doc)
{
$s  "  <li class=\"sitemap\">";
$s .= "<a href=\"[(site_url)][~" $doc['id'] . "~]\" class=\"sitemap\">" $doc['pagetitle'] . "</a>";
$s .= "</li>\n";
$output .= $s;
// end foreach
$output .= "</ul>\n";
break;

case 'txt'// plain text list of URLs

foreach ($docs as $doc)
{
$url '[(site_url)][~'.$doc['id'].'~]';

$output .= $url."\n";
// end foreach
break;

case 'ror'// TODO
default: // Sitemap Protocol


$output = <?xml version="1.0" encoding="UTF-8"?>
'."\n";
if ($xsl != '') {
$output .='<?xml-stylesheet type="text/xsl" href="'.$xsl.'"?>'."\n";
}
$output .='<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">'."\n";


foreach ($docs as $doc) {
$url = '[(site_url)][~'.$doc['id'].'~]';
$date = $doc['editedon'];
$date = date("Y-m-d", $date);
$docPriority = ($doc[$priority]) ? $doc[$priority] : 0; // false if TV doesn't exist
$docChangefreq = ($doc[$changefreq]) ? $doc[$changefreq] : 0; // false if TV doesn't exist

$output .= "\t".'<url>'."\n";
$output .= "\t\t".'<loc>'.$url.'</loc>'."\n";
$output .= "\t\t".'<lastmod>'.$date.'</lastmod>'."\n";
$output .= ($docPriority) ? ("\t\t".'<priority>'.$docPriority.'</priority>'."\n") : ''; // don't output anything if TV doesn't exist
$output .= ($docChangefreq) ? ("\t\t".'<changefreq>'.$docChangefreq.'</changefreq>'."\n") : ''; // don't output anything if TV doesn't exist
$output .= "\t".'</url>'."\n";
} // end foreach
$output .= '</urlset>';

} // end switch

return $output;

# functions
# ---------------------------------------------

# gets (inherited) value of template variable
if (!function_exists('getTv')) {
function getTV($modx,$docid,$doctv)
{
/* apparently in 0.9.2.1 the getTemplateVarOutput function doesn't work as expected and doesn't return INHERITED value; this is probably to be fixed for next release; see http://modxcms.com/bugs/task/464
$output = $modx->getTemplateVarOutput($tv,$docid);
return $output[$tv];
*/

while ($pid = $modx->getDocument($docid,'parent'))
{
$tv = $modx->getTemplateVar($doctv,'*',$docid);
if (($tv['value'] && substr($tv['value'],0,8) != '@INHERIT') or !$tv['value']) // tv default value is overriden (including empty)
{
$output = $tv['value'];
break;
}
else // there is no parent with default value overriden
{
$output = trim(substr($tv['value'],8));
}
$docid = $pid['parent']; // move up one document in document tree
} // end while

return $output;
}
}

# gets list of published documents with properties
if (!function_exists('getTv')) {
function getDocs($modx,$startid,$priority,$changefreq,$excludeTV)
{
// get children documents
$docs = $modx->getAllChildren($startid,'menuindex','asc','id,editedon,template,published,searchable,pagetitle,type');
// add sub-children to the list
foreach ($docs as $key => $doc)
{
$id = $doc['id'];
$docs[$key][$priority] = getTV($modx,$id,$priority); // add priority property
$docs[$key][$changefreq] = getTV($modx,$id,$changefreq); // add changefreq property
$docs[$key][$excludeTV] = getTV($modx,$id,$excludeTV); // add excludeTV property

if ($modx->getActiveChildren($id))
$docs = array_merge($docs, getDocs($modx,$id,$priority,$changefreq,$excludeTV));
} // end foreach
return $docs;
}
}
?>
Author: ManagerManager plugin - customise your ModX manager interface
Pages: 1 ... 4 5 [6] 7 8 ... 11   Go Up
0 Members and 1 Guest are viewing this topic.