-
- 9 Posts
Hey all,
Wonder if you could help, this is probably a dumb question but please bare with me I’m a noob to modx and YAMS (liking it though!!):
I’m looking to create a site that will have multi-lingual and mono-lingual content and have been investigating YAMS.
I need to have a navigation menu that will only display items if:
There is content for that menu item in the language of the page currently being viewed (not all content will exist in all languages)
My wayfinder currently looks like this:
[[Wayfinder?startId=`0` &outerTpl=`mh.OuterTpl` &innerTpl=`mh.InnerTpl`&rowTpl=`@FILE:assets/modules/yams/tpl/wayfinder/doc/row.tpl` &innerRowTpl=`mh.InnerRowTpl` &firstClass=`first` &hereClass=`selected`]]
And my InnerRowTpl
<li[+wf.classes+]>
<a href="(yams_doc:[+wf.docid+])" title="[[YAMS? &get=`data` &docid=`[+wf.docid+]` &from=`pagetitle`]]">[[YAMS? &get=`data` &docid=`[+wf.docid+]` &from=`menutitle`]]</a>
[+wf.wrapper+]
</li>
If not possible simply to configure the wayfinder, is it possible to test this [[YAMS? &get=`data` &docid=`[+wf.docid+]` &from=`menutitle`]] to see if it has content and only output if it does. Giving the user the ability to control it, by entering a menu title in the language or not....
Thanks,
-
- 805 Posts
Hi lhanson.
Since you are going to be using both monolingual and multilingual documents, you will need to make sure you are using my latest release candidate:
YAMS 1.2.0 RC3. Prior to that the [tt][[YAMS? &get=`data` ...]][/tt] snippet call wouldn’t correctly grab the data for monolingual documents.
Currently the only way to incorporate the kind of logic you want is to use PHx. You’ll have to install PHx as a standalone plugin and configure it to execute after YAMS in the plugin event execution order. Then I think you should be able to wrap the content of your Wayfinder templates in code like this:
[+phx:if=`[[YAMS? &get=`data` &docid=`[+wf.docid+]` &from=`menutitle`]]`:isnot=``:then=`
...normal template stuff goes here...
`:else=``+]
I haven’t had time to test it out, but I think it should work.
In the longer term (not in the next couple of weeks, but not too long after that hopefully) I plan to implement some
new YAMS functionality that will make conditional inclusion and exclusion of multilingual content possible without PHx.
-
- 9 Posts
Hi,
Thanks for the info.
I tried the PHX call in the wayfinder template and it appears that wayfinder does not support nested PHX calls.
Would you happen to know how i go about creating my own menu, not using wayfinder?
Thanks,
-
- 805 Posts
Quote from: lhanson at Jul 10, 2010, 08:26 PM
I tried the PHX call in the wayfinder template and it appears that wayfinder does not support nested PHX calls.
I am confused about this. Firstly, Wayfinder doesn’t parse the PHx. To parse the PHx
the PHx plugin needs to be installed and needs to be set to execute after YAMS in the plugin event order.
The PHx parser claims to handle nested tags, so theoretically at least this should work.
When you say it doesn’t work, what actually happens?