Hey team,
I am sure I will find an answer to this here.
[
UPDATE before you try to solve this I have, but it might be worth the read to see the answer and you might be able to explain why]
Having recently discovered the power of TVs I am putting them into practise by adding some values to different pages based on the TV
I have set up the TV named
pagename with
about==about||baby==baby||boys==boys||contact==contact|
OK so far.
I have a snippet called
setpage in each page
[[setpage? &page=`[*pagename*]`]]
and then choose the TV
The snippet looks like this
<?php
echo $page . " - " ;
switch ($page){
case about:
echo "about";
break;
case 'baby':
echo "baby";
break;
case "boys":
echo "boys";
break;
}
?>
The result is that I see the echoed value perfectly, i.e. the TV is passing through to the snippet. BUT I just can’t get the switch to work.
I am pretty experienced with PHP so am fairly certain there is no problem with the switch code, but it isn’t hitting the right ’case". If I put in a default it does hit that.
I have tried just about every workaround I can think of, single, double and back quotes. redefining the variable, singe = rather than double...I have now run out of ideas but know someone here will spot the problem.
he hopes...
thanks in advance.
So...as I previewed this and saw my snippet call I suddenly thought..."cache" and changed the call to [!setpage? &page=`[*pagename*]`!]
Needless to say it worked...sigh...
Is it just me or is the modx cache too "aggressive"?