|
The XMAP extension for Phocagallery includes the category urls, but does not include the picture urls in the site map. This is because most of the options of PhocaGallery include some type of popup for the detail view. Hence, including the picture URLS would cause an error, or at the very least be redirected back to the category url. So you'd have a whole bunch of the same urls in your xmap sitemap.
If you want to include the picture urls in your sitemap, you should first set the detail view to 'no popup.' You'll find this option in the parameters in PhocaGallery.
The below code is a rough draft and I've only barely tested it. It should work, I'm using PhocaGallery 2.7.1 and Joomla 1.5.13. I'll openly admit I've used a good deal of code from the JoomGallery extension for xmap, so kudos to those guys and gals.
Save a backup of your current xmap extension of PhocaGallery BEFORE you upload this one! You use the code below at your own risk! Worst case scenario, it will kill you, but I'm hopeful that will not happen. The file can be found at:
administrator/components/com_xmap/extension/com_phocagallery.php
The new file is below. Copy and paste into a new file and name com_phocagallery.php, upload to the above folder, clean the cache in the xmap options and reload your sitemap. With any luck, all picture urls should be there.
<?php /** * @author MisterWebNet, http://www.misterwebnet.com * @email Yes, please. * @version $Id: com_phocagallery.php 2.7.1 2010-12-13 12:56:12 * @package Xmap * @license GNU/GPL * @description Xmap plugin for PhocaGallery - provided as is with no warranty or guarantee. Please check code before use. This is an altered version and NOT the official version. If you want the official version please go to http://extensions.joomla.org/extensions/extension-specific/xmap-extensions/8004 */
class xmap_com_phocagallery {
function &getTree ( &$xmap, &$parent, &$params ) { $link_query = parse_url( $parent->link ); parse_str( html_entity_decode($link_query['query']), $link_vars ); $catid = JArrayHelper::getValue($link_vars,'id',0);
// Include all pictures $include_pictures = 1; $params['include_pictures'] = $include_pictures;
//Category priority $priority = JArrayHelper::getValue($params,'cat_priority',$parent->priority,''); $changefreq = JArrayHelper::getValue($params,'cat_changefreq',$parent->changefreq,''); if ($priority == '-1') $priority = $parent->priority; if ($changefreq == '-1') $changefreq = $parent->changefreq;
$params['cat_priority'] = $priority; $params['cat_changefreq'] = $changefreq;
//Picture piority $priority = mosGetParam($params,'pictures_priority',$parent->priority); $changefreq = mosGetParam($params,'pictures_changefreq',$parent->changefreq); if ($priority == '-1') $priority = $parent->priority; if ($changefreq == '-1') $changefreq = $parent->changefreq; $params['picture_priority'] = $priority; $params['picture_changefreq'] = $changefreq;
if ( $include_pictures ) { $ordering = mosGetParam($params,'picture_order','ordering'); if ( !in_array($ordering,array('ordering','time','subjet','hits')) ) $ordering = 'ordering'; $params['picture_order'] = $ordering = $ordering; $params['limit'] = ''; $params['days'] = ''; $limit = mosGetParam($params,'max_pictures',''); if ( intval($limit) ) $params['limit'] = ' LIMIT '.$limit; $days = mosGetParam($params,'max_age',''); if ( intval($days) ) $params['days'] = ' AND time >='.($xmap->now - ($days*86400)) ." "; } xmap_com_phocagallery::getPhocaGalleryTree($xmap, $parent, $params, $catid, "");
}//end getTree
function getPhocaGalleryTree ( &$xmap, &$parent, &$params, $categoryid, $categoryAlias ) {
global $database; $xmap->changeLevel(1); $list = array(); $database->setQuery("SELECT id, title, name, alias, parent_id FROM #__phocagallery_categories WHERE parent_id = $categoryid AND published=1 ORDER BY name"); $cats = $database->loadObjectList(); $xmap->changeLevel(1);
foreach($cats as $cat) { $node = new stdclass; $node->id = $parent->id; $node->uid = $parent->uid.'c'.$cat->id; // Uniq ID for the category $node->pid = $cat->parent_id; $node->title = $cat->title? $cat->title : $cat->title; $node->priority = $params['cat_priority']; $node->changefreq = $params['cat_changefreq']; $node->link = 'index.php?option=com_phocagallery&view=category&id='.$cat->id.':'.$cat->alias; if( ($xmap->printNode($node) !== FALSE) ) { xmap_com_phocagallery::getPhocaGalleryTree($xmap, $parent, $params, $cat->id, $cat->alias); } }//end foreach //pictures if ( $params['include_pictures'] ) { $database->setQuery ("select * from #__phocagallery where catid = '".$categoryid."' and published = '1' order by title " ); $pictures=array(); $pictures = $database->loadObjectList();
foreach($pictures as $file) { $node = new stdclass; $node->id = $parent->id; // Itemid $node->uid = $parent->uid .'d'.$file->id; // Uniq ID for the download $node->name = ($file->imgtitle? $file->imgtitle : $file->imgtitle); $node->priority = $params['pictures_priority']; $node->changefreq = $params['pictures_changefreq']; $node->link='index.php?option=com_phocagallery&view=detail&catid='.$categoryid.':'.$categoryAlias.'&id='. $file->id.':'.$file->alias.'';
$xmap->printNode($node); } }//end if pictures $xmap->changeLevel(-1);
}// end getPhocaGalleryTree
}//end class
?> |