Pdomenu questions

all i am very new to Modx , i have pdotools installed and i am trying to add some static code (just social media icons) , but i can not add it after the [[+wapper]] as it disappears and i can not include it before the wrapper as it will duplicate on every new menu item, what would be the best way to tackle the situation ?

here is my current snippet for pdomenu
[[pdoMenu?
&parents=0
&level=1
&outerClass=navbar-nav
&rowClass=nav-item
&linkClass=nav-link
&tpl =@INLINE <li class="nav-item"><a class="nav-link" href="[[+link]]"> [[+menutitle]]</a> </li> [[+wrapper]] ]]

Hi @Syrus83,

What about trying to add your own tplOuter like:

&tplOuter=`@INLINE <ul[[+classes]]>[[+wrapper]]</ul> <div class="social-icons">...</div>`

Thanks for the quick response ,
I tried adding the &tplOuter as suggested but i seem added an extra UL tag,

do i keep the below the same ?
&outerClass= navbar-nav
&rowClass= nav-item
&linkClass= nav-link

If it’s just static html there’s no need to include it in the pdomenu call. Can you just include it in the page template next to the snippet call? If not, can you show the markup structure you’re hoping to achieve?

2 Likes

I believe that you will face some issues using inline code.
I would recommend to avoid inline calls and call a chunk instead.
All problems that I faced with pdotools were solved as soon as I moved to chunks.

Cheers

2 Likes

I just tested using your call above with the added &tplOuter. I have only two resources, home and test.

pdoMenu call:

[[pdoMenu?
    &parents=`0`
    &level=`1`
    &outerClass=`navbar-nav`
    &rowClass=`nav-item`
    &linkClass=`nav-link`
    &tpl=`@INLINE <li class="nav-item"><a class="nav-link" href="[[+link]]"> [[+menutitle]]</a> </li> [[+wrapper]]`
    &tplOuter=`@INLINE <ul[[+classes]]>[[+wrapper]]</ul> <div class="social-icons">...</div>`
]]

The Output:

<ul class="navbar-nav"><li class="nav-item"><a class="nav-link" href="/"> Home</a> </li> <li class="nav-item"><a class="nav-link" href="test.html"> Test</a> </li> </ul> <div class="social-icons">...</div>

So the <ul> is in the &tplOuter markup. Is it possible you’ve got another <ul> in your page template?

2 Likes

thanks every one for their responses,
@lucy i needed the static html to sit in the same ul tag as the rest of the nav items.

Success !
@digitalpenguin thank you , that did the trick , i had originally replaced the &tpl=@INLINE with the &tplOuter=@INLINE , but your code works perfectly.

This is my first site in Modx (moved over from WP) and already appreciate the freedom modx provides.

2 Likes

Fantastic! Glad you got it sorted! :slight_smile:

1 Like

Welcome to modx world! Since I found it, I don’t want anything else!
Cheers!

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.