<![CDATA[ PHx, Template Variables and Wayfinder - My Forums]]> https://forums.modx.com/thread/?thread=45350 <![CDATA[Re: PHx, Template Variables and Wayfinder]]> https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-400809 sottwell Nov 20, 2011, 12:57 PM https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-400809 <![CDATA[Re: PHx, Template Variables and Wayfinder]]> https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-400781 Important: remember that you have to put [+dropdown-menu+] placeholder before the PHx Call, if you remove it PHx will not work.
I never understood why PHx does this. Any ideas?]]>
cipa Nov 20, 2011, 09:01 AM https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-400781
<![CDATA[Re: PHx, Template Variables and Wayfinder]]> https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-400779
1. Create a Template Variable with the following values:
TV Name:
dropdown-menu
TV Description:
Show Dropdown Menu?
TV Type:
DropDown List Menu
Input Option Values:
Yes==0||No==dropdown-none

2. Now add &rowTpl=`chunkname` to your wayfinder snippet call:
[[Wayfinder?  &rowTpl=`chunkname` &parentClass=`dropdown`]]


3. Now go to "chunkname" chunk and put a code similiar to this one:
   
<li class="[+wf.classnames+] [+dropdown-menu+]">
<a href="[+wf.link+]">[+wf.linktext+]</a>
[+phx:if=`[+dropdown-menu+]`:is=`dropdown-none`:then=``:else=`[+wf.wrapper+]`+]
</li>


4. Now, open a resource in the root of your website which has children, set the dropdown for the TV previously created to "No", and then save.

MODX will apply a "dropdown-none" class to the <li> tag of that resource, so basically we can hide arrows or whatever we use to indicate that there is a dropdown menu, using just css. The PHx call will also stop the output for the second level of the menu in the html, so we don't have to hide it with css.

Important: remember that you have to put [+dropdown-menu+] placeholder before the PHx Call, if you remove it PHx will not work.]]>
microcipcip Nov 20, 2011, 08:48 AM https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-400779
<![CDATA[Re: PHx, Template Variables and Wayfinder]]> https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-395233
<li class="myClass [+wf.classnames+] type[+template_variable+]">[+phx:if=`[+template_variable+]`:is=`0`:then=`OPTION A`:else=`OPTION B`+]</li>


'type' is the undefined class that is only used to allow for evaluation of the variable. It would print as 'type0' or 'type1']]>
djad33 Sep 29, 2011, 12:33 PM https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-395233
<![CDATA[Re: PHx, Template Variables and Wayfinder]]> https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-261948 I’ve tried using a snippet to resolve the problem, however I do not understand why this isn’t working properly. hey worchyld,

would you like to share the snippet ... i’m trying to achieve the same smiley

thanks, j]]>
anonymized-26931 Mar 13, 2010, 03:44 AM https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-261948
<![CDATA[Re: PHx, Template Variables and Wayfinder]]> https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-261947
Let’s say that a Wayfinder template chunk contains the following code:
[+phx:if=`[+template_variable+]`:is=`1`:then=`TV is one.`:else=`TV is NOT one.`+]


The evaluation fails because the template variable’s value is not yet available in the PHx evaluation context. Try inserting the template variable in a "hidden" place, for example:

<span="display:none;">[+template_variable+]</span>
[+phx:if=`[+template_variable+]`:is=`1`:then=`It is one.`:else=`It is NOT one.`+]


The above worked for me. I am sure that there must be a better way to make the template variable’s value available at the PHx evaluation context...




]]>
kal_exan Mar 03, 2010, 05:40 AM https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-261947
<![CDATA[Re: PHx, Template Variables and Wayfinder]]> https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-261946
I’ve tried using a snippet to resolve the problem, however I do not understand why this isn’t working properly.

[edit]

I’ve tried creating a simple checkbox with the value of "Yes" if it is checked, assigning it to a FAQ child page and then using the &rowTpl to ask whether the value is the default value of "0", and if is it is, then display the child page.

I’ve tried 3 different ways to get &rowTpl from Wayfinder and PHX to work with template variables and display a child page on an if-else statement and it just won’t have it.]]>
worchyld Jun 01, 2009, 02:35 PM https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-261946
<![CDATA[Re: PHx, Template Variables and Wayfinder]]> https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-261945
Thanks for your reply.

I tried:

// Chunk: WF_rowTpl_Sitemap
// Chunk for the &rowTpl Wayfinder
[+phx:if=`[*sitemap_exclude*]`:is=`0`:then=`{{Sitemap_rowTpl}}`+]


Sitemap_rowTpl is:

<li[+wf.id+][+wf.classes+]><a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>[+wf.wrapper+]</li>


But I still get nothing returned/displayed, even though there should be something there.

If I put:

// Chunk: WF_rowTpl_Sitemap
// Chunk for the &rowTpl Wayfinder
[+phx:if=`[*sitemap_exclude*]`:is=`0`:then=`[+wf.linktext+]`+]


I get:

Home About Us Destination Guides Contact Us FAQs Latest Deals 


But I do not get any sub-items, or indeed any of the children living in FAQs, even though there are children that are included.

// Template Variable: sitemap_exclude
Radio Options
Input Option Values: Include==0||Exclude==1
Default Value: 0
]]>
worchyld Jun 01, 2009, 01:20 PM https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-261945
<![CDATA[Re: PHx, Template Variables and Wayfinder]]> https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-261944 sottwell Jun 01, 2009, 12:24 PM https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-261944 <![CDATA[PHx, Template Variables and Wayfinder]]> https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-261943
If its 1 then this means to hide the entry from the sitemap.

<li[+wf.id+][+wf.classes+]>
[+phx:if=`[+sitemap_exclude+]`:is=`0`:then=`[+sitemap_exclude+]`+]
[+sitemap_exclude+] -- 
<a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>[+wf.wrapper+]</li>


The problem is:

1) If I do this:

[+phx:if=`[+sitemap_exclude+]`:is=`1`:then=`{{Sitemap_rowTpl}}`+]


Nothing ever appears.

I am trying to figure out what I am doing wrong with respects to the PHX, I want it to do this:

1. If the [+sitemap_exclude+] = 1 then show the list-item in my Wayfinder &rowTpl

But for some reason it doesn’t work.

What is the correct way of doing this?]]>
worchyld Jun 01, 2009, 12:12 PM https://forums.modx.com/thread/45350/phx-template-variables-and-wayfinder#dis-post-261943