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) 3
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.3k points) 9 52 62
0 like 0 dislike
And it was already some v1.4x plugins that do just that....
answered by (296 points) 11 43 48
Welcome to e107 Q&A, where you can ask questions and receive answers from other members of the e107 community.
747 questions
1,157 answers
1,968 comments
1,242 users