Hi!
Well it's kind of a complex for the particular webpage. But I'll try to explain...
1) In my default template I have the call for [ [Left_menuOrBasket] ].
2)I have snippet [ [ Left_menu or Basket ] ] like this:
<?php
$left_menu = $modx->runSnippet('Left_menu');
if(!empty($left_menu)){
return '<div id="left-menu" class="box1 border1">
<div class="box2">
'.$left_menu.'
</div>
</div>';
} elseif($modx->documentIdentifier == $modx->runSnippet('config', array('vertiba' => 'basket'))) {
return '<div id="left-menu" class="box1 border1">
<div class="box2">
'.$modx->runSnippet('Left_basket').'
</div>
</div>';
}
?>
3.Then again for a snippet [ [Left-menu] ] I have like this:
$top = 0;
$id = $modx->documentIdentifier;
$topLevel= 0;
$pid_a = array();
if ($id && $id != $top) {
$pid= $id;
array_unshift($pid_a, $pid);
if (!$topLevel || count($modx->getParentIds($id)) >= $topLevel) {
while ($parentIds= $modx->getParentIds($id, 1)) {
$pid= array_pop($parentIds);
array_unshift($pid_a, $pid);
if ($pid == $top) {
break;
}
$id = $pid;
if ($topLevel && count($modx->getParentIds($id)) < $topLevel) {
break;
}
}
}
}
if(isset($pid_a[1]) && is_numeric($pid_a[1]) /*&& sizeof($modx->getChildIds($pid_a[1]))*/) {
$pdoc = $modx->getDocument($pid_a[1]);
$tv = $modx->getTemplateVarOutput(array("class"), $pid_a[1]);
$params = array(
'startId' => $pid_a[1],
'level' => 2,
'lastClass' => 'last',
//'parentRowTpl' => 'wayfinderParentRowTpl'
);
if(isset($tv['class']) && !empty($tv['class'])){
$params['outerClass'] = $tv['class'];
}
$html = $modx->runSnippet('Wayfinder', $params);
if(trim(strip_tags($html)) != '')
return '<div class="cat">'.$pdoc['menutitle'].'</div>'.$html.'
';
}
?>
4. And the [ [Wayfinder] ] snippet I have like this:
$wayfinder_base = $modx->config['base_path']."assets/snippets/wayfinder/";
//Include a custom config file if specified
$config = (isset($config)) ? "{$wayfinder_base}configs/{$config}.config.php" : "{$wayfinder_base}configs/default.config.php";
if (file_exists($config)) {
include_once("$config");
}
include_once("{$wayfinder_base}wayfinder.inc.php");
if (class_exists('Wayfinder')) {
$wf = new Wayfinder();
} else {
return 'error: Wayfinder class not found';
}
$wf->_config = array(
'id' => isset($startId) ? $startId : $modx->documentIdentifier,
'level' => isset($level) ? $level : 0,
'includeDocs' => isset($includeDocs) ? $includeDocs : 0,
'excludeDocs' => isset($excludeDocs) ? $excludeDocs : 0,
'ph' => isset($ph) ? $ph : FALSE,
'debug' => isset($debug) ? TRUE : FALSE,
'ignoreHidden' => isset($ignoreHidden) ? $ignoreHidden : FALSE,
'hideSubMenus' => isset($hideSubMenus) ? $hideSubMenus : TRUE,
'useWeblinkUrl' => isset($useWeblinkUrl) ? $useWeblinkUrl : TRUE,
'fullLink' => isset($fullLink) ? $fullLink : FALSE,
'nl' => isset($removeNewLines) ? '' : "\n",
'sortOrder' => isset($sortOrder) ? strtoupper($sortOrder) : 'ASC',
'sortBy' => isset($sortBy) ? $sortBy : 'menuindex',
'limit' => isset($limit) ? $limit : 0,
'cssTpl' => isset($cssTpl) ? $cssTpl : FALSE,
'jsTpl' => isset($jsTpl) ? $jsTpl : FALSE,
'rowIdPrefix' => isset($rowIdPrefix) ? $rowIdPrefix : FALSE,
'textOfLinks' => isset($textOfLinks) ? $textOfLinks : 'menutitle',
'titleOfLinks' => isset($titleOfLinks) ? $titleOfLinks : 'pagetitle',
'displayStart' => isset($displayStart) ? $displayStart : FALSE,
);
//get user class definitions
$wf->_css = array(
'first' => isset($firstClass) ? $firstClass : '',
'last' => isset($lastClass) ? $lastClass : 'last',
'here' => isset($hereClass) ? $hereClass : 'active',
'parent' => isset($parentClass) ? $parentClass : '',
'row' => isset($rowClass) ? $rowClass : '',
'outer' => isset($outerClass) ? $outerClass : '',
'inner' => isset($innerClass) ? $innerClass : '',
'level' => isset($levelClass) ? $levelClass: '',
'self' => isset($selfClass) ? $selfClass : '',
'weblink' => isset($webLinkClass) ? $webLinkClass : '',
);
//get user templates
$wf->_templates = array(
'outerTpl' => isset($outerTpl) ? $outerTpl : '',
'rowTpl' => isset($rowTpl) ? $rowTpl : '',
'parentRowTpl' => isset($parentRowTpl) ? $parentRowTpl : '',
'parentRowHereTpl' => isset($parentRowHereTpl) ? $parentRowHereTpl : '',
'hereTpl' => isset($hereTpl) ? $hereTpl : '',
'innerTpl' => isset($innerTpl) ? $innerTpl : '',
'innerRowTpl' => isset($innerRowTpl) ? $innerRowTpl : '',
'innerHereTpl' => isset($innerHereTpl) ? $innerHereTpl : '',
'activeParentRowTpl' => isset($activeParentRowTpl) ? $activeParentRowTpl : '',
'categoryFoldersTpl' => isset($categoryFoldersTpl) ? $categoryFoldersTpl : '',
'startItemTpl' => isset($startItemTpl) ? $startItemTpl : '',
);
//Process Wayfinder
$output = $wf->run();
if ($wf->_config['debug']) {
$output .= $wf->renderDebugOutput();
}
//Ouput Results
if ($wf->_config['ph']) {
$modx->setPlaceholder($wf->_config['ph'],$output);
} else {
return $output;
}
?>
As I didn't make this home page myself, I'm not sure what I need to correct...
Maybe you as a wiser person can tell me?
And yes, I'm usin Evo.