• TechQA.

    Create a Bootstrap menu with WayFinder

    1.1k views Asked by AudioBubble At 2016-09-09T17:07:04+00:00 09 September 2016 at 17:07 2025-12-20T14:46:02+00:00

    Trying to create a Bootstrap menu with WayFinder. How to finish it?

    <ul class="nav navbar-nav">
       <li class="dropdown">
          <a href="#" class="dropdown-toggle" id="drop1" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Dropdown <span class="caret"></span> </a> 
          <ul class="dropdown-menu" aria-labelledby="drop1">
             <li><a href="#">Action</a></li>
             <li><a href="#">Another action</a></li>
             <li><a href="#">Something else here</a></li>
             <li role="separator" class="divider"></li>
             <li><a href="#">Separated link</a></li>
          </ul>
       </li>
       <li class="dropdown">
          <a href="#" class="dropdown-toggle" id="drop2" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Dropdown <span class="caret"></span> </a> 
          <ul class="dropdown-menu" aria-labelledby="drop2">
             <li><a href="#">Action</a></li>
             <li><a href="#">Another action</a></li>
             <li><a href="#">Something else here</a></li>
             <li role="separator" class="divider"></li>
             <li><a href="#">Separated link</a></li>
          </ul>
       </li>
    </ul>

    My WayFinder call so far:

    [[Wayfinder? &startId=`0` &level=`1`
                                   &hideSubMenus=`TRUE` &includeDocs=`1,2,3,4,5,55,7,8,74`
                                   &outerTpl=`chunk_navigation-menu`]]
    

    And my chunk_navigation-menu looks like this: <ul class="navbar-nav nav">[+wf.wrapper+]</ul>

    modx modx-evolution wayfinder
    Original Q&A
    1

    There are 1 answers

    1
    Daniel M. Melo Daniel M. Melo On 2016-09-10T18:42:03+00:00 10 September 2016 at 18:42 BEST ANSWER

    First of all, I am assuming you are using MODX Evolution.

    The easiest way to do that is using

    &outerClass
    &parentClass
    &innerClass
    &parentRowTpl
    

    In your Wayfinder call.

    It should look like this:

    [[Wayfinder? &startId=`[(site_start)]` &level=`2` &outerClass=`nav navbar-nav` &parentClass=`dropdown` &innerClass=`dropdown-menu` &parentRowTpl=`navbar_parentRowTpl`]]
    

    Note: If you don't use [(site_start)] in your context(s), replace it with your menu's parent resource ID.

    Also in this case you would have to create the navbar_parentRowTpl. This chunk should look like this:

    <li[+wf.id+][+wf.classes+] class="dropdown" id="menu[+id+]">
    <a class="dropdown-toggle" data-toggle="dropdown" data-target="#menu[+id+]" href="[+wf.link+]" title="[+wf.title+]">
        [+wf.linktext+]
        <b class="caret"></b>
    </a>
    [+wf.wrapper+]</li>
    

    As it's been a long time I don't work with Evo, if there is some problem with this code let me know and I can help you.

    I used this example as reference: https://gist.github.com/mkay/f0afc97ec1536932e0a3

    And used this table to convert to the Evo syntax:

    https://rtfm.modx.com/revolution/2.x/making-sites-with-modx/tag-syntax

    Related Questions in MODX

    • Tracking the date of a resource's major changes on MODX3
    • When sending a link in the messenger, the preview is displayed in only one language
    • After the redirect I get the page: Site 'xxx' has redirected too many times
    • When a client leaves a request,he receives an automatic response,and regardless of what language the form is in,he sends the EN version of the letter
    • I need to get the TV field of the child resource
    • It is necessary to implement the link so that the English version don't have the prefix /en/
    • Modx. When I try to compress an image for mobile phones using pThumb, nothing happens
    • MODX, curl and the anonymous sessions
    • Displaying the latest topics with the first post from the forum to the website
    • How can I filter multiple field using checkbox and HTMX?
    • Upload permission modx
    • Sort gallery modx
    • modx migx. How to start idx from 6?
    • MODX3 Manager language setting
    • Sum objects in array by the key of month

    Related Questions in MODX-EVOLUTION

    • MODX3 Manager language setting
    • How to add recent snippet name or document name to browser tab (title) in Manager?
    • Changing mail_smtp_user in a MODX snippet
    • How to parse the document content and then process the final HTML within a snippet? (EVO2)
    • Chunks not saving self-closing tags. Any way to fix?
    • Can i use {{sometitle}} as text (without parsing as chunk) in modx evo?
    • Modx Evo / Debian 9: Cannot open file (/assets/cache//sitePublishing.idx.php)
    • MODX Evolution upgrade: how can I identify snippet/plugin changes to be kept?
    • Load Resource content of other document into recent document and execute its snippets - Evolution CMS (former ModX Evo)
    • Fancybox navigation on Modx Evo doesn't work
    • MODX evo - are these bugs in assets images folder?
    • ModX Evolution: Where is SMTP password stored?
    • Use template-variable as img alt but this is not picked up by search engines
    • Ditto call excludes docs by template-variable
    • Create a Bootstrap menu with WayFinder

    Related Questions in WAYFINDER

    • wayfinder printing class as content in accordion
    • Wayfinder: Display the Resources that are "under" another Resource with Wayfinder
    • how to add paths to indoor mapping in leaflet?
    • ModX wayfinder - works on some pages but not on others
    • How can I get Babel and WayFinder working with different contexts and unique startids?
    • ModX Revo: TagLister: Display Tag name on Tag page
    • Create a Bootstrap menu with WayFinder
    • Is there a way to apply a seperate template to different levels in Wayfinder?
    • MODx Wayfinder &level=2 exclude ALL but one
    • MODX Revolution Wayfinder return empty line
    • Menu with div inside on ModX
    • Change CSS class in Wayfinder MODx menu dependent on page template
    • Wayfinder includeDocs only showing first level reasources
    • ModX wont work without absolute paths
    • Wayfinder closing tags

    Popular Questions

    • How do I undo the most recent local commits in Git?
    • How can I remove a specific item from an array in JavaScript?
    • How do I delete a Git branch locally and remotely?
    • Find all files containing a specific text (string) on Linux?
    • How do I revert a Git repository to a previous commit?
    • How do I create an HTML button that acts like a link?
    • How do I check out a remote Git branch?
    • How do I force "git pull" to overwrite local files?
    • How do I list all files of a directory?
    • How to check whether a string contains a substring in JavaScript?
    • How do I redirect to another webpage?
    • How can I iterate over rows in a Pandas DataFrame?
    • How do I convert a String to an int in Java?
    • Does Python have a string 'contains' substring method?
    • How do I check if a string contains a specific word?

    Popular Tags

    javascript python java c# php android html jquery c++ css ios sql mysql r reactjs node.js arrays c asp.net json

    Trending Questions

    • UIImageView Frame Doesn't Reflect Constraints
    • Is it possible to use adb commands to click on a view by finding its ID?
    • How to create a new web character symbol recognizable by html/javascript?
    • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
    • Heap Gives Page Fault
    • Connect ffmpeg to Visual Studio 2008
    • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
    • How to avoid default initialization of objects in std::vector?
    • second argument of the command line arguments in a format other than char** argv or char* argv[]
    • How to improve efficiency of algorithm which generates next lexicographic permutation?
    • Navigating to the another actvity app getting crash in android
    • How to read the particular message format in android and store in sqlite database?
    • Resetting inventory status after order is cancelled
    • Efficiently compute powers of X in SSE/AVX
    • Insert into an external database using ajax and php : POST 500 (Internal Server Error)
    • Privacy
    • Terms
    • Cookies
    • Homegardensmart
    • Math
    • Aftereffectstemplates