0vote

А menu that displays a different image by date

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

tgtje commented Dec 14, 2017

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 ??

1 Answer

0vote

Jimako Points1186
You are messing php text/string variables with php functions. Really php fundamental knowledge, nothing related with e107.

Please log in or register to answer this question.

Know someone who can answer? Share a link to this

...

e107 Q&A is a Question and Answer platform where e107 users can ask questions themselves and answer each others questions. By doing so users can earn badges and points and become e107 experts.

This community platform is a valuable tool for sharing and gaining knowledge on e107. Go ahead and find out yourself!

Connect with us