As mentioned above, I was able to get the smart BG module working (v2) as I wanted for the header area of my site, but now I'm trying to use the same mod to place another BG image on the same page in a CSS positioned DIV. To do this I'm reusing the same code that normally goes in the tpl_main_page.php, in the tpl_header.php file, but renaming the variables from smart to cat to avoid conflict.
This is the code in tpl_header.php
PHP Code:
<?php //Smart Backgrounds
$cat_image = '';
$unique_ezpages = false;//change to false to not have diff bg for each ezpage
if ($current_page_base == 'index' or $current_page_base == 'product_info') { //add _ and top cat id to bg filename only if cat bg image exists
$cat_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'catbg_' . str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath]) . '.jpg'))?'_' . str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath]):'';
} elseif ($current_page_base == 'page' and $unique_ezpages == true) { //add _page and ez-page id to bg filename only if cat bg image exists
$cat_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'catbg_page' . $_GET[id] . '.jpg'))?'_page' . $_GET[id]:'';
} else { //add _ and page base to bg filename only if page bg image exists
$cat_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'catbg_' . $current_page_base . '.jpg'))?'_' . $current_page_base:''; //default/home page class will be just .smartBG, and filename smartbg.gif
}// /Smart Backgrounds?>
<div id="cell_3_3" class="catBG<?php echo $cat_image;?>>
</div>
and this is the content of stylesheet_catBG.css
HTML Code:
#cell_3_3 {background-image:url(../images/catbg_index.jpg); position: absolute; left: 0px; top: 80px; width: 99px; height: 354px; }
/*MX category */
.catBG_34 #cell_3_3 { background-image: url(../images/catbg_34.jpg); position: absolute; left: 0px; top: 80px; width: 99px; height: 354px;}
/*SnowMobile Category */
.catBG_35 #cell_3_3 { background-image: url(../images/catbg_35.jpg); position: absolute; left: 0px; top: 80px; width: 99px; height: 354px;}
The #cell_3_3 {background-image:..........
correctly places the image on the page, but the other images aren't presented when you change categories.
The only code I can see that is different to my working version is the div line in tpl_header.php
PHP Code:
<div id="cell_3_3" class="catBG<?php echo $cat_image;?>>
I'm developing offline, but I'm prepared to upload for assessment if needed.
Any help greatly appreciated.
OZ
Bookmarks