• &hereClass not showing for a weblink?#

  • lmentop Reply #1, 3 years, 8 months ago

    Reply
    My menu is working correctly with the exception of setting the hereClass for my main page and when you click the home link. All other pages work fine.

    This is the code I'm using.
    [[Wayfinder? &startId=`[[UltimateParent]]` &level=`1` &webLinkClass=`` &rowClass=`` &levelClass=`` &firstClass=`` &lastClass=`` &selfClass=`` &useWeblinkUrl=`false`]]


    On my document tree I have my main page, with the weblink and other pages just below it. The weblink calls on the main document's ID and I tried using the full page address too.

    All other pages get assigned the class "active" when their links are selected.

    What am I missing?
    http://www.law.gmu.edu/org/els


  • sottwell Reply #2, 3 years, 8 months ago

    Reply
    That's because the page you get when a weblink is selected is not the actual weblink document; rather it's the document the weblink points to.


  • lmentop Reply #3, 3 years, 8 months ago

    Reply
    Is there anyway around it or an easy way to get it to work?


  • lmentop Reply #4, 3 years, 8 months ago

    Reply
    A friend solved it by adding an id for each element pertaining to its page number and setting a template variable to add some extra css just on the front page to set the link to be active...

    it makes sense to me...


  • Zombie Reply #5, 3 years, 6 months ago

    Reply
    Hi there.

    i solve this problem by small Wf hack. there is:

    in assets/snippets/wayfinder/wayfinder.inc.php in function isHere($did) (near 268 line) i change code like this
        function isHere($did) {
    	// begin weblink 'here' patch
    	global $modx;
    	$doc = $modx->getDocumentObject('id', $did);
    	if ($doc['type'] == 'reference')
    	  $did = $doc['content'];
    	// end weblink 'here' patch
            return in_array($did,$this->parentTree);
        }
    


    work fine by me, but now i think how to minimize getDocumentObject() calls and do it only for documents withreference'. It's can be done just add one param $type='document' to isHere() function and change their call in 248 line of wayfinder.inc.php. May be it's will be better that the current solution.

    Hope it's help anybody.

    King regards!


  • jonasfr Reply #6, 3 years, 1 month ago

    Reply
    As far as i've tested you're changes there are occuring problems with sorting on mysql version 4.1 when there is a SELECT DISTINCT without a GROUP BY statement, so i just added the GROUP BY clause on line 380, but i think this will make problems in mysql version 5 so if there is anybody who got a solution working for every version... let me know

    $sql = "SELECT DISTINCT {$fields} FROM {$tblsc} sc LEFT JOIN {$tbldg} dg ON dg.document = sc.id WHERE sc.published=1 AND sc.deleted=0 AND ({$access}){$menuWhere} AND sc.id IN (".implode(',',$ids).") GROUP BY sc.id ORDER BY {$sort} {$this->_config['sortOrder']} {$sqlLimit};";
    


  • aldrin123 Reply #7, 1 year, 3 months ago

    Reply
    Hey, I know it is a very old post, but I would like to tell everyone over here that it was very useful for me. I went through all the answers and it is highly appreciable that such help are provided over here. I would definitely come here if I get a problem.


  • Hlight Reply #8, 1 year, 2 months ago

    Reply
    I solved this in MODx Revolution 2.0.8-pl without hacking the Wayfinder code or adding custom css.

    Basically by using two additional snippets: If and getResourceField, I'm able to check the weblink content and compare it to the current documents URL... when the two match the class of "current" is added to the weblink menu item.

    Full details posted here:
    http://modxcms.com/forums/index.php/topic,62431.msg354718.html#msg354718