`How to make an if condition in modx to display a menu?
A
A
ak_wi2020-06-04 19:04:15
MODX
ak_wi, 2020-06-04 19:04:15

How to make an if condition in modx to display a menu?

There is a piece of code that displays a menu (if any)

[[pdoMenu?
                                    &parents=`2`
                                    &level=`1`
                                    &where=`{"template":4}`
                                    &tplOuter=`@INLINE <ul>[[+wrapper]]</ul>`
                                    &tpl=`@INLINE <li><a[[+classes]] href="[[+link]]" [[+attributes]]>[[+menutitle]]</a>[[+wrapper]]</li>`
                                ]]


But how to make a working condition out of it, what if there is no menu, did it display the layout?

Examples from the docks do not give the desired effect

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
A
Anton Tarasov, 2020-06-04
@ak_wi

[[!pdoMenu:default=`<p>вывести этот текст вместо пустого меню</p>`?
                                    &parents=`2`
                                    &level=`1`
                                    &where=`{"template":4}`
                                    &tplOuter=`@INLINE <ul>[[+wrapper]]</ul>`
                                    &tpl=`@INLINE <li><a[[+classes]] href="[[+link]]" [[+attributes]]>[[+menutitle]]</a>[[+wrapper]]</li>`
                                ]]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question