I have trouble uploading OSMAP sitemaps to google because of a plugin I am using. That plugin called autoanchor menu creates a menu based on titles in an article. really usefull for long articles.
Anyway, the problem is that plugin will add an opening div and ending div to every page of joomla, even if the module is set to be used only on specific pages in the modules parameters.
So the opening of my XML starts like that :
<div class="auto-anchor-start-marker" style="display:none"></div><?xml version="1.0" encoding="UTF-8"?>
I'm looking for a way to have a php clause saying to avoid messing with the xml sitemap. If I disable the plugin, it works fine and the sitempa is accepted by google. Really lost here.
here's the PHP file that is called :
<?php
/**
* @copyright
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access.
defined('_JEXEC') or die;
jimport('joomla.plugin.plugin');
class plgSystemJtricks_AutoAnchor extends JPlugin
{
public function onAfterDispatch()
{
if (JFactory::getApplication()->isAdmin())
{
return;
}
// Adjust the component buffer.
$doc = JFactory::getDocument();
$buf = $doc->getBuffer('component');
$buf = '<div class="auto-anchor-start-marker" style="display:none"></div>'
. $buf
. '<div class="auto-anchor-stop-marker" style="display:none"></div>';
$doc->setBuffer($buf, 'component');
return;
}
}
or another php file :
<?php
/**
* @copyright
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();
$document->addScript(JURI::root() . 'modules/mod_jtricks_autoanchor/autoanchormenu-1.11.js');
$beginningTop = $params->get('beginningTop');
$beginningTopText = $params->get('beginningTopText');
$beginningBottom = $params->get('beginningBottom');
$beginningBottomText = $params->get('beginningBottomText');
for ($i = 1; $i <= 6; $i++)
{
$hlevel[$i] = $params->get('h' . $i . 'level');
}
$endTop = $params->get('endTop');
$endTopText = $params->get('endTopText');
$endBottom = $params->get('endBottom');
$endBottomText = $params->get('endBottomText');
$class_sfx = htmlspecialchars($params->get('class_sfx'));
$useSmoothScroll = $params->get('useSmoothScroll');
$smoothScrollX = $params->get('smoothScrollX');
$smoothScrollY = $params->get('smoothScrollY');
$namesFromHeaderText = $params->get('namesFromHeaderText');
$showActive = $params->get('showActive');
$activeStyle = $params->get('activeStyle');
$cssOverride = $params->get('cssOverride');
$verticalMargin = $params->get('verticalMargin');
$useTrackPage = $params->get('useTrackPage') == '1';
$useTrackEvent = $params->get('useTrackEvent') == '1';
$useJsLibrary = $params->get('useJsLibrary');
$useSpecialMooMore = $params->get('useSpecialMooMore');
if (strlen($cssOverride) > 0)
$document->addStyleDeclaration($cssOverride);
if ($useSmoothScroll == 1 && $useSpecialMooMore == '1')
$document->addScript(JURI::root() . 'modules/mod_jtricks_autoanchor/mootools-more-1.4.0.1.js');
else
JHtml::_('behavior.framework', true);
$autoAnchorId = 'autoanchormenu_' . $module->id;
$autoAnchorModuleInit = "AutoAnchorMenu.moduleInit['". $autoAnchorId . "']";
$ulSelector = 'ul#' . $autoAnchorId;
if (strlen($activeStyle) > 0)
$document->addStyleDeclaration($ulSelector . ' li.active a.auto_anchor_menu_item {' . $activeStyle . '}');
if (strlen($verticalMargin) > 0 && $verticalMargin != '0')
$document->addStyleDeclaration(' a.auto_anchor { position:relative; top:' . strval(- intval($verticalMargin)) . 'px } ');
$registerParams =
($useTrackPage ? ', true' : ', false') .
($useTrackEvent ? ', true' : ', false');
$optionsEntryMarkup = '<li class="$clazz$"><a class="auto_anchor_menu_item" href="#anchor" onclick="AutoAnchorMenu.registerClick(this' . $registerParams . ')">$title$</a>';
$optionsEntryPostfix = '</li>';
$optionsLevelDown = '<ul>';
$optionsLevelUp = '</ul>';
$optionsShowActive = $showActive == 1 ? 'true' : 'false';
// Gantry-based templates have special rendering for mod_menu
// We need to repeat that in order to match Gantry-based template menu module visuals.
$templateName = JFactory::getApplication()->getTemplate();
$gantryFileName = JRoute::_('templates/'.$templateName)."/lib/gantry/gantry.php";
if (file_exists($gantryFileName))
{
$optionsEntryMarkup = '<li class="parent $clazz$"><a class="auto_anchor_menu_item" href="#anchor" onclick="AutoAnchorMenu.registerClick(this' . $registerParams . ')"><span>$title$</span></a>';
}
?>
<!-- BEGIN: AutoAnchor Menu ( -->
<ul id="<?php echo $autoAnchorId;?>" class="menu<?php echo $class_sfx;?>"><li style="display:none"></li></ul>
<script type="text/javascript">
//<![CDATA[
if (AutoAnchorMenu.moduleInit == undefined)
AutoAnchorMenu.moduleInit = {};
if (AutoAnchorMenu.moduleInitComplete == undefined)
AutoAnchorMenu.moduleInitComplete = {};
<?php echo $autoAnchorModuleInit;?> = function ()
{
if (AutoAnchorMenu.moduleInitComplete['<?php echo $autoAnchorId;?>'])
return;
AutoAnchorMenu.moduleInitComplete['<?php echo $autoAnchorId;?>'] = true;
AutoAnchorMenu('<?php echo $autoAnchorId;?>',
{
<?php
if ($namesFromHeaderText != '1')
echo 'namesFromHeaderText: false,';
?>
entryMarkup: '<?php echo $optionsEntryMarkup; ?>',
entryPostfix: '<?php echo $optionsEntryPostfix; ?>',
levelDown: '<?php echo $optionsLevelDown; ?>',
levelUp: '<?php echo $optionsLevelUp; ?>',
showActive: <?php echo $optionsShowActive; ?>,
handledProperty: 'autoAnchorGathered'
})
<?php
if ($beginningTop == '1')
echo ".scatterTop('" . $beginningTopText . "')";
if ($beginningBottom == '1')
echo ".scatterBottom('" . $beginningBottomText . "')";
if ($beginningTop == '1' || $beginningBottom == '1')
echo ".gather()";
for ($i = 1; $i <= 6; $i++)
{
if ($hlevel[$i] != '0')
echo ".scatter('h" . $i . "', " . $hlevel[$i] . ")";
}
echo ".gather()";
if ($endTop == '1')
echo ".scatterTop('" . $endTopText . "')";
if ($endBottom == '1')
echo ".scatterBottom('" . $endBottomText . "')";
if ($endTop == '1' || $endBottom == '1')
echo ".gather()";
if ($showActive == 1)
echo ".selectActive()";
?>
;
<?php
if ($smoothScrollX == 1 && $smoothScrollY == 1)
$smoothScrollAxes = "['x', 'y']";
else if ($smoothScrollX == 1)
$smoothScrollAxes = "'x'";
else if ($smoothScrollY == 1)
$smoothScrollAxes = "'y'";
else
$smoothScrollAxes = "''";
echo "if (location.hash != undefined) location.hash = '' + location.hash;";
if ($useSmoothScroll == 1)
echo "new Fx.SmoothScroll({ links: '.auto_anchor_menu_item', axes: " . $smoothScrollAxes . "});";
?>
};
if (window.jQuery)
jQuery(<?php echo $autoAnchorModuleInit;?>);
window.addEvent('domready', <?php echo $autoAnchorModuleInit;?>);
window.addEvent('load', <?php echo $autoAnchorModuleInit;?>);
//]]>
</script>
I guess these are the files where to do this.
please help ;) ;)