Quote from: bobd72 at Nov 13, 2013, 08:16 PMPerhaps the solution to my problem is in Wayfinder rather than in the JQuery menu code.
I have a number of Category menu items, some of which go directly to a page when clicked and others which activate a submenu on hover. However if the ones which activate the submenu are clicked they go to a blank page if set as a document, or a blank folder if they are set as a container.
Is there some way, perhaps using wayfinder calls, to ensure that if a category menu item is set as a container that it does not react to a click, staying on the current page and displaying the submenu as it does now? I have tried using the link attributes but there appears to be no way of achieving this by that means.
Thanks for the assistance.
If I'm getting what you're saying, then I wrote a small addon for this very problem. It creates menu links based on the first page down the tree that actually has content in any given menu structure, so if you have a Category menu item that is a folder in the tree, but no content, the link in the menu will get changed to the first document under that folder that has content (or, if the first document is itself a folder, to the first one under that, etc.). So, the menu item Category won't link to itself, but to the first actual page in that section. Please check it out:
http://modx.com/extras/package/firstpagelink
There are instructions for how to alter your wayfinder row templates (chunks).
The other solution is to put, in the header of every page, some code like this:
// check whether this is a container, and if so load child page
if(($modx->resource->get('content')=='') {
$goodpage=$modx->runSnippet('firstPageLink',array('pid'=>$modx->resource->get('id')));
if(strlen($goodpage)>1) {
header("Location: $goodpage");
}
}
If you don't want to use firstPageLink, then you could change the line of code that references that to code that fetches the first published page that has the current page as its parent. This method doesn't change the links in the menus, but rather makes blank pages redirect to ones that have content.