this would allways process all contents of all chunks.
Here is another solution to get this done:
Create a listbox-TV with input-options like:
chunk1=={{chunk1}}||chunk2=={{chunk2}}||chunk3=={{chunk3}}||chunk4=={{chunk4}}
and a default-value of:
put the TV-tag
of your listbox-TV into your Template
now you can choose the chunk to use for that page (if you want a chunk, other than chunk4)
Hi Bruno17,
Actually I am trying to call a css id instead of a chunk here. In my case, I have a situation where I need to call a css class depending upon the page id, eg if page id is 1 display #cssid1, if page id is 2, display #cssid2 else display #cssid4 etc. Sorry for not getting the question correct in the first place.
Does phx do this?
Bruno17's solution absolutely worked fine for me. I am using his suggestion currently. I could include the css call in chunks and select a particular chunk for individual page, and works like a charm.
Still want to know if phx can handle this.
well, you can try something like that:
[*id:is=`1`:then=`{{chunk1}}`:else=`
[*id:is=`2`:then=`{{chunk2}}`:else=`
[*id:is=`3`:then=`{{chunk3}}`:else=`
{{chunk4}}
`*]
`*]
`*]
you could also create a simple switch-snippet, somthing like that:
https://forums.modx.com/thread/45396/help-formatting-a-phx-condtional-for-switching-classes#dis-post-262240
[ed. note: Bruno17 last edited this post 14 years, 1 month ago.]
-
☆ A M B ☆
- 24,524 Posts
Keep in mind that phx/output modifiers is a scripting language built in PHP, which is itself a scripting language. So the more complex your modifiers, the slower it's going to be. For anything more than one or two conditions, you're much better off with a snippet.