Once a client wanted a website containg pages having one specific image at a certain place of the page. (In this case it was his own face.) Only in some cases he wanted to change the image.
Usually images are placed via editing a page. However, in this case it was worth to load the image via the template.htm file. There it was said:
<?php if ($news==""){echo newsbox("mainImage");} else {echo newsbox($news);} ?>
A hidden page was generated called “mainImage” (#CMSimple hide#). This page contained nothing else than just the image which was supposed to show up on most pages. Pages which were supposed to contain alternativ images were provided with a CMSimple script.
#CMSimple $news = 'altImage1';#
or
#CMSimple $news = 'altImage2';#
or
#CMSimple $news = 'altImage3';#
etc.
Hidden pages called altImage1, altImage2, altImage3 etc. contained the alterantive images.
Instead of using a newsbox it is also possible to call up the images directly by adding to the template.htm file the code:
<img alt="Top-Image" <?php if ($topimage==''){?>src="<?php echo $pth['folder']['templateimages'];?>topimage1.jpg" /> <?php }else{?>src="<?php echo $pth['folder']['templateimages']; echo $topimage;?>.jpg" /><?php } ?>
The CMSimple script on a page would then say:
#CMSimple $topimage = "image1";#
or
#CMSimple $topimage = "image2";#
or
#CMSimple $topimage = "image3";#
etc.
Images called “image1.jpg”, “image2.jpg”, “image3.jpg” etc. or similar have to be found in template's “image” subfolder, of course.
~~DISCUSSION~~