Didn’t function, I did this as a test:
<?php
$id = $modx->resource->get('id');
switch ($id) {
case '33':
return "[[$randomimagephotos1]]";
break;
case '32':
return "[[$randomimagephotos2]]";
break;
case '4':
return "[[$randomimagephotos3]]";
break;
default:
return "[[$randomimagephotos4]]";
}
return;
?>
and also added $modx->resource->get(’id’); to my old snippet to see if it worked, and it didn’t.
perhaps I should explain what I was trying to do and how I did it in evo bear with me.
I had a single template and I wanted a graphic particular to that page to be shown, but I also wanted that graphic to change with each visit.
Now, getting the page to show something particular per id was easy, getting it to change images contained within a folder specific to that page was easy as well, combining the two was not.
I had to create a TV (syntax changed to reflect revo now) [[*imagesubheader]]
then in the default of that tv I placed a snippet [[imagesubheader]]
the snippet contained the code above which returned chunks according to page id
within the chunk was a div which, in turn, contained yet another snippet which randomized the images.
here is the chunk
<div class="content_photo" id="content_photo">[[randomimagephotos1]]</div>
and the random snippet:
<?php
$total = "10";
$file_type = ".jpg";
$image_folder = "assets/templates/mysites_template/images/page1images";
$start = "1";
$random = mt_rand($start, $total);
$image_name = $random . $file_type;
echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />";
?>
it was a total pain in the behind, but it was the only way it worked, I had tried it in several ways but using the TV was the only solution which worked.
so is there a syntax error, or am I causing a conflict with in revo that I could get away with in evolution? I am stumped...