We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38873
    • 10 Posts
    Hi everyone! I need some advises to resolve my problem. I don't know what could be the possible reason...
    So the problem....
    I have created menu with wayfinder snippet and every thing seems to work properly, but then I came across the problem which is - if I add any submenu in the container and click in the "Show in menu", the parent resource is no longer clickable in the menu.
    What could be the issue? [ed. note: dii-ii last edited this post 14 years, 7 months ago.]
      • 36926
      • 701 Posts
      What's your wayfinder call and any wayfinder templates you are using.

      I'm guessing this is for Evo as you've put "show in menu" as apposed to "hide from menu"
        • 38873
        • 10 Posts
        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.
          • 36926
          • 701 Posts
          Whats the html for the following chunks:

          parentRowHereTpl
          parentRowTpl
          activeParentRowTpl

          One of them probably doesn't have the a tag to make the parent a click able link, most likely either parentRowHereTpl or activeParentRowTpl.
            • 38873
            • 10 Posts
            Well I just check all the chunks, and there is not such chunks as parentRowHereTpl or activeParentRowTpl.... there is just parentRowTpl.
            So I guess that could be the issue.
            But then again - if I make these chunks, what should I do next?

              • 36926
              • 701 Posts
              Whats the code for parentRowTpl
                • 38873
                • 10 Posts
                Hi, weel I got the solution - I just added the parentRowHereTpl in chunks and double-checked everything, and now it look like all is fine.
                But believe it or not, now I have another problem laugh
                For one section of the webpage I don't need it to hide sub-menus. so what I did is:

                I duplicate all the templates, chunks and snippet related to wayfinder and rename them, so that the new template wouldn't hide the submenus, but the duplicated template either way uses the original one Wayfinder snippet - if I change hideSubMenus to TRUE - it hides the submenus even in that section of webpage to what I set different template.....
                Did you get my point?