Hi!
With this Modification, you can change your Banner every X Days automatically.
This Modification works without Javascript.
This Modification was a wish from a Member of this Forum.
1.) Copy the File "install_banner.php" from the Attachment in your Gallery "root" and call it to.
2.) Copy the File "banner_change.php" from the Attachment in your Gallery/admin/ folder.
3.) search in admin/index.php:
show_nav_option($lang['nav_general_stats'], "stats.php?action=resetstats");
insert below:
//################## Start Automatic Banner change #############################
show_nav_option($lang['nav_banner_change'], "banner_change.php");
//################## End Automatic Banner change ###############################
4.) search in includes/constants.php.php
define('WORDMATCH_TABLE', $table_prefix.'wordmatch');
insert below:
//################## Start Automatic Banner change #########
define('BANNER_TABLE', $table_prefix.'banner');
//################## End Automatic Banner change ###########
5.) search in includes/functions.php "?>" and insert above:
//################## Start Automatic Banner change ################################
function banner_check(){
global $site_db;
$time_current = time();
$sql = "SELECT b.image_id, b.cat_id, b.image_name,b.set_time,b.time_interval, i.image_id,i.image_active,i.image_media_file
FROM (".BANNER_TABLE." b, ".IMAGES_TABLE." i)
WHERE i.image_active =1 AND i.image_id = b.image_id AND b.set_time > ($time_current - (time_interval * 60*60))
";
$row = $site_db->query_firstrow($sql);
if($row){
$banner = "<img src=\"".MEDIA_PATH."/".$row['cat_id']."/".$row['image_media_file']."\">";
return $banner;
}
}
function banner_change(){
global $site_db;
$time_current = time();
$banner_check = banner_check();
if($banner_check){
return $banner_check;
}
else{
$sql = "UPDATE ".BANNER_TABLE."
set set_time = $time_current
";
$site_db->query($sql);
return banner_check();
}
}
//################## End Automatic Banner change ################################
6.) search in includes/page_header.php
$site_template->register_vars(array(
"home_url" => ROOT_PATH,
and replace:
$site_template->register_vars(array(
//################## Start Automatic Banner change ######################
"banner_change" => banner_change(),
//################## End Automatic Banner change ########################
"home_url" => ROOT_PATH,
7.) search in lang/your lang/admin.php
//-----------------------------------------------------
//--- Categories --------------------------------------
insert above:
(deutsch)
//################## Start Automatic Banner change #############
$lang['nav_banner_change'] = "Automatischer Banner wechsel";
$lang['banner_change'] = 'Automatischer Banner wechsel';
$lang['time_interval'] = 'Zeitinterval in Stunden:';
$lang['delete_table'] = 'Tabelle Löschen';
$lang['table'] = 'Tabelle:';
$lang['delete'] = 'Löschen';
//################## End Automatic Banner change ###############
(english)
//################## Start Automatic Banner change #############
$lang['nav_banner_change'] = 'Automatically Banner Change';
$lang['banner_change'] = 'Automatically Banner Change';
$lang['time_interval'] = 'Time interval in Hours:';
$lang['delete_table'] = 'Delete Table';
$lang_table = 'Table:';
$lang['delete'] = 'Delete';
//################## End Automatic Banner change ###############
8.) insert in templates/your templates/ home.html or where ever you want:
{banner_change}
Now you found the "Automatically Banner change" in "ACP" above "General/phpinfo()" .
mfg Andi