Good morning all,
I'm having a difficult time finding the right info I'm looking for and I feel I'm so close. So, essentially I need to have a footer display the proper chat window depending on what page the viewer is on. I *could* do all this making unique templates for each and every chat I need and just add the chat window stuff in, but I feel thats the improper way of coding.
The code I have thus far is
[[*id:is=`43`:then=`This will display Code A`:or:id:is=`9`:then=`This will display CODE B`:else=`[[$pc-hhl]]`]]
The code logic looks fine to me, so I'm unsure of where I'm going wrong.
Admittedly I am a jr dev who has switched to IT so my coding skills are getting a bit relaxed. Thank you in advance
Output modifers may not be the best way to get the job done. What you could do, if its likely to be on more than just a set array of resources, is to create a template variable where you could just toggle the chat code on and off. So if for example you created a TV called 'chat' you could toggle between what chunk will be displayed with the below code.
[[*chat:notempty=`[[$ChatCodeA]]`:else=`[[$ChatCodeB]]`]]
Another method would be to create a snippet and test for resource ids, or template ids, and then output the correct chunk needed. Below detects if template id '1' or '3' is used.
if ($modx->resource->get('template') == '3' || '1') {
$chunk = $codeAChunk;
} else {
$chunk = $codeBChunk;
}
return $modx->getChunk($chunk);
Ok thank you for the input. I went ahead and just created different templates with different footer chunks in the mean time. My idea was to have 3 different pages pull up 3 different chats.
Thank you