e107help.org Q&A
0 like 0 dislike

I try to create a menu that displays a different image by date.

I started with this code, but I get an error. Where is the problem?

<?php
/*
+ ----------------------------------------------------------------------------+
|     e107 website system
+----------------------------------------------------------------------------+
*/

$text = "
<div style='text-align: center'>
<div class='spacer'>
switch(date('Y-m-d')) {
  // specific date image
  case '2017-12-25':
    print '<img src="/path/to/christmas.jpg" alt="" />';
    break;
case '2018-01-01':
    print '<img src="/path/to/newy.jpg" alt="" />';
    break;
  // fallback image
  default:
    print '<img src="/path/to/default.jpg" alt="" />';
    break;
}
</div>
</div>";     
$ns -> tablerender(EVCOUNT_L1,  $text, 'eventcount');
?>

e107 version v. 0.7
asked in Plugins by (2 points)
This is for v7 ??? Anyway : code errors due to the use of single ' and/or " (apostrophs) You start a 'piece/block"by $text= " >> so everything below this (till close) NO double " (apostrph.) rest unsure think best to make it a simple page (on root ala test php) and ttry calling in i frame inside menu ??

2 Answers

0 like 0 dislike
You are messing php text/string variables with php functions. Really php fundamental knowledge, nothing related with e107.
answered by (1.5k points) 5 16 21
0 like 0 dislike
And it was already some v1.4x plugins that do just that....
answered by (295 points) 2 9 9
Welcome to e107 Q&A, where you can ask questions and receive answers from other members of the e107 community.
781 questions
1,189 answers
2,035 comments
2,136 users