Jump to content

timed images


Cubeboy

Recommended Posts

can anyone help with this code. I want to be able to show and image between a certain date set. but I can't seem to get this to work. can anyone help? in the header.tpl file

 

THANK YOU!   THANK YOU!   THANK YOU!!
 

                    {include file="$template/includes/navbar.tpl" navbar=$secondaryNavbar}

                </ul>

            </div><!-- /.navbar-collapse -->
        </div>
    </nav>

</section>

{if $templatefile == 'homepage'}
    <section id="home-banner">

#### MY CODE IS HERE   
    

{php}

    
$sb = date("z");    
    
if ($sb <= 90 and $sb >= 61) {
$m_subbanner ="<a href=\"https://XXXXX.COM/site-lock.php/\"><img src=\"subbanner/sl.jpg\"></a>" ;} 

else { 
if ($sb <= 120 and $sb >= 91) {
$m_subbanner ="<a href=\"https://XXXXX.COM/video-conf.php\"><img src=\"subbanner/videoconf.jpg\"></a>" ;} 


else { 
if ($sb <= 120 and $sb >= 91) {
$m_subbanner ="<a href=\"https://XXXXX.COM/seo-marketing.php\"><img src=\"subbanner/seo.jpg\"></a>" ;} 

else {
$m_subbanner ="<img src=\"subbanner/default.jpg\">" ; }


}}

<div class="container text-center">

 echo $m_subbanner; 
 
 
 {/php}
 

#### MY CODE ENDS






        </div>  
        
    </section>
    <div class="home-shortcuts">
        <div class="container">
            <div class="row">
                <div class="col-md-4 hidden-sm hidden-xs text-center">
                    <p class="lead">
                        {$LANG.howcanwehelp}
                    </p>


 

Link to comment
Share on other sites

the first thing to do is to move your PHP code to ActionHook:ClientAreaPage and pass the final results as variables to be displayed in your template more easily and securely

<?php

add_hook("ClientAreaPage", 1, function($vars){
	
  	$dayoftheyear = date("z");    
    if ($dayoftheyear >= 61 && $dayoftheyear <= 90) {
      $m_subbanner ="<a href=\"https://XXXXX.COM/site-lock.php/\"><img src=\"subbanner/sl.jpg\"></a>";
    }
  	elseif ($dayoftheyear >= 91 && $dayoftheyear <= 120) {
      $m_subbanner ="<a href=\"https://XXXXX.COM/video-conf.php\"><img src=\"subbanner/videoconf.jpg\"></a>";
    }
  	elseif ($dayoftheyear >= 121 && $dayoftheyear <= 180) {
      $m_subbanner ="<a href=\"https://XXXXX.COM/seo-marketing.php\"><img src=\"subbanner/seo.jpg\"></a>";
    }
  	else {
      $m_subbanner ="<img src=\"subbanner/default.jpg\">";
    }

	return array("m_subbanner" => $m_subbanner);
});

then in your template use {$m_subbanner} to display the image

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated