Forums / All Other Contributions/Addons / Smart Backgrounds support

Smart Backgrounds support

Views: 55,899

Results 181 to 200 of 393
15 Dec 2008, 7:29 AM
#182
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

I removed stylesheet_smartbg.css.

I could not find ```

<body id="aboutusBody" class="smartBG"> ```What is next? Could I have a problem in tpl_main_page.php?

Sawhorse

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

15 Dec 2008, 7:49 AM
#183
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Smart Backgrounds support

That was the output HTML - you will not see it as such in tpl_main_page.php.

Do you have smartbg_aboutus.jpg in /includes/templates/your_template/images/? If the code found that, it would be making the "smartBG_aboutus" classname.

15 Dec 2008, 7:52 AM
#184
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

I need to crash and will talk to you later. I am worried that I may not have done my tpl_main_page.php so I have included it here.

<?php
/**
 * Common Template - tpl_main_page.php
 *
 * Governs the overall layout of an entire page<br />
 * Normally consisting of a header, left side column. center column. right side column and footer<br />
 * For customizing, this file can be copied to /templates/your_template_dir/pagename<br />
 * example: to override the privacy page<br />
 * - make a directory /templates/my_template/privacy<br />
 * - copy /templates/templates_defaults/common/tpl_main_page.php to /templates/my_template/privacy/tpl_main_page.php<br />
 * <br />
 * to override the global settings and turn off columns un-comment the lines below for the correct column to turn off<br />
 * to turn off the header and/or footer uncomment the lines below<br />
 * Note: header can be disabled in the tpl_header.php<br />
 * Note: footer can be disabled in the tpl_footer.php<br />
 * <br />*/
   $flag_disable_header = true;
/* $flag_disable_left = true;<br />*/
   $flag_disable_right = true;
/* $flag_disable_footer = true;<br />
 * <br />
 * // example to not display right column on main page when Always Show Categories is OFF<br />
 * <br />
 * if ($current_page_base == 'index' and $cPath == '') {<br />
 *  $flag_disable_right = true;<br />
 * }<br />
 * <br />
 * example to not display right column on main page when Always Show Categories is ON and set to categories_id 3<br />
 * <br />
 * if ($current_page_base == 'index' and $cPath == '' or $cPath == '3') {<br />
 *  $flag_disable_right = true;<br />
 * }<br />
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_main_page.php 3183 2006-03-14 07:58:59Z birdbrain $
 */

// the following IF statement can be duplicated/modified as needed to set additional flags
  if (in_array($current_page_base,explode(",",'list_pages_to_skip_all_right_sideboxes_on_here,separated_by_commas,and_no_spaces')) ) {
    $flag_disable_right = true;
  }


  $header_template = 'tpl_header.php';
  $footer_template = 'tpl_footer.php';
  $left_column_file = 'column_left.php';
  $right_column_file = 'column_right.php';
  $body_id = str_replace('_', '', $_GET['main_page']);
?>

<?php //Smart Backgrounds
$smart_image = '';
if ($current_page_base == 'index' or $current_page_base == 'product_info') { //add _ and top cat id to classname only if cat bg image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath]) . '.gif'))?'_' . str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath]):'';
} elseif ($current_page_base == 'page') { //add _page and ez-page id to classname only if ez-page id bg image exists, else add _page to classname only if general ez-page bg image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_page' . $_GET[id] . '.gif'))?'_page' . $_GET[id]:(file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_page.gif')?'_page':'');
} else { //add _ and page base to classname only if page bg image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . $current_page_base . '.gif'))?'_' . $current_page_base:''; //default/home page classname will be just .smartBG, and filename smartbg.gif
}// /Smart Backgrounds?>
<body id="<?php echo $body_id . 'Body'; ?>" class="smartBG<?php echo $smart_image;?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>>
<!-- End Smart Backgrounds -->

<!-- Added a container div to hold all page information -->
<!-- Including bottom footer info and banners -->
<!-- mainWrapper now has a background applied to it -->
<div id="container">

<!-- begin mainWrapper -->
<div id="mainWrapper">
<!-- begin header/logo area -->
<div id="logoWrapper">
    <div id="logo"><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . '</a>'; ?></div>
    <div id="taglineWrapper">
<?php
              if (HEADER_SALES_TEXT != '') {
?>
      <div id="tagline"><?php echo HEADER_SALES_TEXT;?></div>
<?php
              }
?>
</div>
<!-- end logoWrapper --></div>
<div id="navigation">

    <!-- Begin Search --><div id="search">
    <div id="searchbox"><?php require(DIR_WS_MODULES . 'sideboxes/search_header.php'); ?></div>
    <!-- End Search --></div>
    
    <!-- begin top navigation -->
    
<?php
     if (STORE_STATUS == '0' and !$_SESSION['customer_id']) { 
            $menubg = 'topmenubg_login.jpg';
     } else {
            $menubg = 'topmenubg.jpg';
     } 
?> 

<?php //Smart Backgrounds - for foreground logo - 20081212
$smart_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') { //change filename to $menubg and top cat id only if cat image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . $menubg . str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath]) . '.gif'))?$menubg . str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath] . '.gif'):'.gif';
} elseif ($current_page_base == 'page' and $unique_ezpages == true) { //change filename to $menubg_page and ez-page id only if ez-page image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . $menubg . 'page' . $_GET[id] . '.gif'))?$menubg . 'page' . $_GET[id] . '.gif':'.gif';
} else { //change filename to $menubg and pagename only if  page image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . $menubg . $current_page_base . '.gif'))?$menubg . $current_page_base . '.gif':'.gif'; //default/home page image will be as defined ($menubg.gif)
}// /Smart Backgrounds

$menubg .= $smart_image;?> 

<?php
     if (STORE_STATUS == '0' and !$_SESSION['customer_id']) { 
            $menuclass = 'login';
     } else {
            $menuclass = 'noLogin';
     } 
?>

<div id="navMain" class="<?php echo $menuclass;?>">    
        <a href="/"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="Home Page" width="156" height="44" border="0" /></a>
        
        <?php if ($_SESSION['customer_id']) { ?>
        
        <a href="index.php?main_page=login"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="My Account" width="94" height="44" border="0" /></a>
        <a href="index.php?main_page=logoff"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="Log Out" width="70" height="44" border="0" /></a>
        
                <?php
              } else {
                if (STORE_STATUS == '0') {
            ?>

        <a href="index.php?main_page=login"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="My Account" width="94" height="44" border="0" /></a>
        <a href="index.php?main_page=login"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="Log In" width="70" height="44" border="0" /></a>
        
        <?php } } ?>
        <a href="index.php?main_page=shop"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="Shop On Line" width="50" height="44" border="0" /></a>
        <a href="index.php?main_page=shopping_cart"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="Shopping Cart" width="100" height="44" border="0" /></a>
        <a href="index.php?main_page=checkout_shipping"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="Checkout Now" width="80" height="44" border="0" /></a>
    <!-- end top nav --></div>
    
<!-- end navigation wrapper --></div>

<!-- begin content Main wrapper -->
<div id="contentMainWrapper" class="clearfix">

<div id="right">
    <div id="center">
    <div><!-- bof  breadcrumb --><?php if (DEFINE_BREADCRUMB_STATUS == '1') { ?>
    <div id="navBreadCrumb">You Are Here> <?php echo $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR); ?></div>
    <?php } ?>
    <!-- eof breadcrumb --></div>
    
    <div><?php
      if (SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) {
    if ($banner->RecordCount() > 0) {
    ?>
    <div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
        }
      }
    ?>

    <?php
     /**
      * prepares and displays center column
      *
      */
    require($body_code); ?><br />

    <?php
      if (SHOW_BANNERS_GROUP_SET4 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET4)) {
    if ($banner->RecordCount() > 0) {
    ?>
    <div id="bannerFour" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
        }
      }
    ?></div>
    <!-- end center --></div>
    
<!-- end right --></div>


<div id="left">
<div id="navColumnOne" >
<?php
if (COLUMN_LEFT_STATUS == 0 or (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == '')) {
  // global disable of column_left
  $flag_disable_left = true;
}
if (!isset($flag_disable_left) || !$flag_disable_left) {
?>

<?php
 /**
  * prepares and displays left column sideboxes
  *
  */
?>
<div id="navColumnOneWrapper" style="width: <?php echo BOX_WIDTH_LEFT; ?>"><?php require(DIR_WS_MODULES . zen_get_module_directory('column_left.php')); ?></div>

<?php
}
?>

<!-- End navColumnOne --></div>
<!-- end left --></div>

<!-- end content Main wrapper --></div>

<!-- begin bottom navigation -->
<div id="bottomnav">
    <div id="navSuppWrapper">
    <div id="navSupp">
    <ul>
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?> :: </a></li>
    <?php if (EZPAGES_STATUS_FOOTER == '1' or (EZPAGES_STATUS_FOOTER == '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])))) { ?>
    <li><?php require($template->get_template_dir('tpl_ezpages_bar_footer.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_ezpages_bar_footer.php'); ?></li>
    <?php } ?>
    </ul>
    </div>
    <!-- end navSuppWrapper --></div>
<!-- end bottom navigation --></div>


<!-- end mainWrapper --></div>

<!-- begin footer -->
<div>

    <div id="copyright">
    <?php
    /**
    * prepares and displays footer output
    *
    */
    require($template->get_template_dir('tpl_footer.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_footer.php');?>
    <!-- end copyright --></div>

    <!-- Begin footer --><div id="footer">
    <!--bof- parse time display -->
    <?php
    if (DISPLAY_PAGE_PARSE_TIME == 'true') {
    ?>
    <div class="smallText center">Parse Time: <?php echo $parse_time; ?> - Number of Queries: <?php echo $db->queryCount(); ?> - Query Time: <?php echo $db->queryTime(); ?></div>

    <?php
      }
    ?>
    <!--eof- parse time display -->
    <!--bof- banner #6 display -->
    <?php
    if (SHOW_BANNERS_GROUP_SET6 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET6)) {
    if ($banner->RecordCount() > 0) {
    ?>
    <div id="bannerSix" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
        }
      }
    ?>
    <!--eof- banner #6 display -->
    <!-- end bottom --></div>

<!-- End container -->
</div>
</div>
</body>

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

15 Dec 2008, 7:53 AM
#185
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

Let me look at your last post. will be right back.

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

15 Dec 2008, 7:59 AM
#186
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

Yes, I have have smartbg_aboutus.jpg in /includes/templates/Series_12_Horses/images/

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

15 Dec 2008, 8:05 AM
#187
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

Before I go should topmenubg_login.jpg not be topmenubg_login.gif and topmenubg.jpg shoudl it not be topmenubg.gif?

Sawhorse

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

15 Dec 2008, 8:08 AM
#188
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

Tried it- did not work.

Need sleep - Later BYE

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

15 Dec 2008, 8:11 AM
#189
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Smart Backgrounds support

Your copy of the Smart Backgrounds code still refers to .gif - all of those need to become .jpg, since your images for that location are smartbg.jpg and smartbg_aboutus.jpg.

The topmenu images can be whatever you want, since they are not involved in the smartbg file-checking code.

15 Dec 2008, 8:16 AM
#190
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Smart Backgrounds support

<?php //Smart Backgrounds - .jpg version
$smart_image = '';
if ($current_page_base == 'index' or $current_page_base == 'product_info') { //add _ and top cat id to classname only if cat bg image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath]) . '.jpg'))?'_' . str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath]):'';
} elseif ($current_page_base == 'page') { //add _page and ez-page id to classname only if ez-page id bg image exists, else add _page to classname only if general ez-page bg image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_page' . $_GET[id] . '.jpg'))?'_page' . $_GET[id]:(file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_page.jpg')?'_page':'');
} else { //add _ and page base to classname only if page bg image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . $current_page_base . '.jpg'))?'_' . $current_page_base:''; //default/home page classname will be just .smartBG, and filename smartbg.jpg
}// /Smart Backgrounds?>
<body id="<?php echo $body_id . 'Body'; ?>" class="smartBG<?php echo $smart_image;?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>>
<!-- End Smart Backgrounds -->
15 Dec 2008, 8:23 AM
#191
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Smart Backgrounds support

Just for fun, a more efficient version of part of this code:```php

<?php //Smart Backgrounds - .jpg version $smart_image = ''; if ($current_page_base == 'index' or $current_page_base == 'product_info') { //add _ and top cat id to classname only if cat bg image exists $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . (int)$_GET[cPath] . '.jpg'))?'_' . (int)$_GET[cPath]:''; } elseif ($current_page_base == 'page') { //add _page and ez-page id to classname only if ez-page id bg image exists, else add _page to classname only if general ez-page bg image exists $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_page' . $_GET[id] . '.jpg'))?'_page' . $_GET[id]:(file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_page.jpg')?'_page':''); } else { //add _ and page base to classname only if page bg image exists $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . $current_page_base . '.jpg'))?'_' . $current_page_base:''; //default/home page classname will be just .smartBG, and filename smartbg.jpg }// /Smart Backgrounds?> <body id="<?php echo $body_id . 'Body'; ?>" class="smartBG<?php echo $smart_image;?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>> <!-- End Smart Backgrounds --> ```Type-casting $_GET[cPath] as integer strips the subcategories from the top cat just as well as the involved str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath]) code.
15 Dec 2008, 4:34 PM
#192
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

gjh42:

Just for fun, a more efficient version of part of this code:```php

<?php //Smart Backgrounds - .jpg version $smart_image = ''; if ($current_page_base == 'index' or $current_page_base == 'product_info') { //add _ and top cat id to classname only if cat bg image exists $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . (int)$_GET[cPath] . '.jpg'))?'_' . (int)$_GET[cPath]:''; } elseif ($current_page_base == 'page') { //add _page and ez-page id to classname only if ez-page id bg image exists, else add _page to classname only if general ez-page bg image exists $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_page' . $_GET[id] . '.jpg'))?'_page' . $_GET[id]:(file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_page.jpg')?'_page':''); } else { //add _ and page base to classname only if page bg image exists $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . $current_page_base . '.jpg'))?'_' . $current_page_base:''; //default/home page classname will be just .smartBG, and filename smartbg.jpg }// /Smart Backgrounds?> <body id="<?php echo $body_id . 'Body'; ?>" class="smartBG<?php echo $smart_image;?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>> <!-- End Smart Backgrounds --> ```Type-casting $_GET[cPath] as integer strips the subcategories from the top cat just as well as the involved str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath]) code.

OK replaced the above code in tpl_main_page.php however if you look at my code just below** <!-- End Smart Backgrounds -->** you see code ```php
$menubg .= $smart_image;?>


```php
<?php //Smart Backgrounds - .jpg version
$smart_image = '';
if ($current_page_base == 'index' or $current_page_base == 'product_info') { //add _ and top cat id to classname only if cat bg image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . (int)$_GET[cPath] . '.jpg'))?'_' . (int)$_GET[cPath]:'';
} elseif ($current_page_base == 'page') { //add _page and ez-page id to classname only if ez-page id bg image exists, else add _page to classname only if general ez-page bg image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_page' . $_GET[id] . '.jpg'))?'_page' . $_GET[id]:(file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_page.jpg')?'_page':'');
} else { //add _ and page base to classname only if page bg image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . $current_page_base . '.jpg'))?'_' . $current_page_base:''; //default/home page classname will be just .smartBG, and filename smartbg.jpg
}// /Smart Backgrounds?>
<body id="<?php echo $body_id . 'Body'; ?>" class="smartBG<?php echo $smart_image;?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>>
<!-- End Smart Backgrounds -->

$menubg .= $smart_image;?> 

<?php
     if (STORE_STATUS == '0' and !$_SESSION['customer_id']) { 
            $menuclass = 'login';
     } else {
            $menuclass = 'noLogin';
     } 
?>

<div id="navMain" class="<?php echo $menuclass;?>">    
```Oh, one more thing - On post 164 > Moving the login check to tpl_header.php means more filename efficiency. Class names can be switched based only on the page for most elements, and an added class name can be used to further control the #navMain bg.Do we need to worry about this or do we have it covered above in tpl_main_page.php.

Again, thanks - Sleep helps ;-)

Sawhorse

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

15 Dec 2008, 5:37 PM
#193
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

OK, I went over all our posts and to the best of my ability I reconstituted tpl_main_page.php (see below). I put in the latest jpg version etc. The only understanding issue I have is with one of your posts #165

You wrote:
Now scrap the filenames so the stylesheet can handle all the permutations. Build a class name instead, and add that to the #navMain div: PHP Code:
<?php if (STORE_STATUS == '0' and !$_SESSION['customer_id']) { $menuclass = 'login'; } else { $menuclass = 'noLogin'; } ?>
<div id="navMain" class="<?php echo $menuclass;?>">

Also in post 175 you wrote:

You don't need to change the code below #navMain. Just replace the code above it, and strip the background styling out of #navMain: PHP Code:
<div id="navMain" style="background-image: url(includes/templates/Series_12_Horses/images/<?= $menubg; ?>); background-repeat: no-repeat;">

//to this

<div id="navMain" class="<?php echo $menuclass;?>">               

     
                                                                                   __________________

I do not know if I remove things correctly.

I have placed my new tpl_main_page.php below. (I believe in my previous version of tpl_main_page.php I double coded some of your code.

Also - what about that login check to tpl_header.php I believe it is tpl_main_page.php

<?php
/**
 * Common Template - tpl_main_page.php
 *
 * Governs the overall layout of an entire page<br />
 * Normally consisting of a header, left side column. center column. right side column and footer<br />
 * For customizing, this file can be copied to /templates/your_template_dir/pagename<br />
 * example: to override the privacy page<br />
 * - make a directory /templates/my_template/privacy<br />
 * - copy /templates/templates_defaults/common/tpl_main_page.php to /templates/my_template/privacy/tpl_main_page.php<br />
 * <br />
 * to override the global settings and turn off columns un-comment the lines below for the correct column to turn off<br />
 * to turn off the header and/or footer uncomment the lines below<br />
 * Note: header can be disabled in the tpl_header.php<br />
 * Note: footer can be disabled in the tpl_footer.php<br />
 * <br />*/
   $flag_disable_header = true;
/* $flag_disable_left = true;<br />*/
   $flag_disable_right = true;
/* $flag_disable_footer = true;<br />
 * <br />
 * // example to not display right column on main page when Always Show Categories is OFF<br />
 * <br />
 * if ($current_page_base == 'index' and $cPath == '') {<br />
 *  $flag_disable_right = true;<br />
 * }<br />
 * <br />
 * example to not display right column on main page when Always Show Categories is ON and set to categories_id 3<br />
 * <br />
 * if ($current_page_base == 'index' and $cPath == '' or $cPath == '3') {<br />
 *  $flag_disable_right = true;<br />
 * }<br />
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_main_page.php 3183 2006-03-14 07:58:59Z birdbrain $
 */

// the following IF statement can be duplicated/modified as needed to set additional flags
  if (in_array($current_page_base,explode(",",'list_pages_to_skip_all_right_sideboxes_on_here,separated_by_commas,and_no_spaces')) ) {
    $flag_disable_right = true;
  }


  $header_template = 'tpl_header.php';
  $footer_template = 'tpl_footer.php';
  $left_column_file = 'column_left.php';
  $right_column_file = 'column_right.php';
  $body_id = str_replace('_', '', $_GET['main_page']);
?>

<?php //Smart Backgrounds - .jpg version
$smart_image = '';
if ($current_page_base == 'index' or $current_page_base == 'product_info') { //add _ and top cat id to classname only if cat bg image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . (int)$_GET[cPath] . '.jpg'))?'_' . (int)$_GET[cPath]:'';
} elseif ($current_page_base == 'page') { //add _page and ez-page id to classname only if ez-page id bg image exists, else add _page to classname only if general ez-page bg image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_page' . $_GET[id] . '.jpg'))?'_page' . $_GET[id]:(file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_page.jpg')?'_page':'');
} else { //add _ and page base to classname only if page bg image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . $current_page_base . '.jpg'))?'_' . $current_page_base:''; //default/home page classname will be just .smartBG, and filename smartbg.jpg
}// /Smart Backgrounds?>
<body id="<?php echo $body_id . 'Body'; ?>" class="smartBG<?php echo $smart_image;?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>>
<!-- End Smart Backgrounds -->

<!-- Added a container div to hold all page information -->
<!-- Including bottom footer info and banners -->
<!-- mainWrapper now has a background applied to it -->
<div id="container">

<!-- begin mainWrapper -->
<div id="mainWrapper">
<!-- begin header/logo area -->
<div id="logoWrapper">
    <div id="logo"><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . '</a>'; ?></div>
    <div id="taglineWrapper">
<?php
              if (HEADER_SALES_TEXT != '') {
?>
      <div id="tagline"><?php echo HEADER_SALES_TEXT;?></div>
<?php
              }
?>
</div>
<!-- end logoWrapper --></div>
<div id="navigation">

    <!-- Begin Search --><div id="search">
    <div id="searchbox"><?php require(DIR_WS_MODULES . 'sideboxes/search_header.php'); ?></div>
    <!-- End Search --></div>
    
    <!-- begin top navigation -->
    
<?php
     if (STORE_STATUS == '0' and !$_SESSION['customer_id']) { 
            $menubg = 'topmenubg_login.jpg';
     } else {
            $menubg = 'topmenubg.jpg';
     } 
?> 

<?php
     if (STORE_STATUS == '0' and !$_SESSION['customer_id']) { 
            $menuclass = 'login';
     } else {
            $menuclass = 'noLogin';
     } 
?>
<div id="navMain" class="<?php echo $menuclass;?>">
        <a href="/"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="Home Page" width="156" height="44" border="0" /></a>
        
        <?php if ($_SESSION['customer_id']) { ?>
        
        <a href="index.php?main_page=login"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="My Account" width="94" height="44" border="0" /></a>
        <a href="index.php?main_page=logoff"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="Log Out" width="70" height="44" border="0" /></a>
        
                <?php
              } else {
                if (STORE_STATUS == '0') {
            ?>

        <a href="index.php?main_page=login"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="My Account" width="94" height="44" border="0" /></a>
        <a href="index.php?main_page=login"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="Log In" width="70" height="44" border="0" /></a>
        
        <?php } } ?>
        <a href="index.php?main_page=shop"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="Shop On Line" width="50" height="44" border="0" /></a>
        <a href="index.php?main_page=shopping_cart"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="Shopping Cart" width="100" height="44" border="0" /></a>
        <a href="index.php?main_page=checkout_shipping"><img src="includes/templates/Series_12_Horses/images/spacer.gif" alt="Checkout Now" width="80" height="44" border="0" /></a>
    <!-- end top nav --></div>
    
<!-- end navigation wrapper --></div>

<!-- begin content Main wrapper -->
<div id="contentMainWrapper" class="clearfix">

<div id="right">
    <div id="center">
    <div><!-- bof  breadcrumb --><?php if (DEFINE_BREADCRUMB_STATUS == '1') { ?>
    <div id="navBreadCrumb">You Are Here> <?php echo $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR); ?></div>
    <?php } ?>
    <!-- eof breadcrumb --></div>
    
    <div><?php
      if (SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) {
    if ($banner->RecordCount() > 0) {
    ?>
    <div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
        }
      }
    ?>

    <?php
     /**
      * prepares and displays center column
      *
      */
    require($body_code); ?><br />

    <?php
      if (SHOW_BANNERS_GROUP_SET4 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET4)) {
    if ($banner->RecordCount() > 0) {
    ?>
    <div id="bannerFour" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
        }
      }
    ?></div>
    <!-- end center --></div>
    
<!-- end right --></div>


<div id="left">
<div id="navColumnOne" >
<?php
if (COLUMN_LEFT_STATUS == 0 or (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == '')) {
  // global disable of column_left
  $flag_disable_left = true;
}
if (!isset($flag_disable_left) || !$flag_disable_left) {
?>

<?php
 /**
  * prepares and displays left column sideboxes
  *
  */
?>
<div id="navColumnOneWrapper" style="width: <?php echo BOX_WIDTH_LEFT; ?>"><?php require(DIR_WS_MODULES . zen_get_module_directory('column_left.php')); ?></div>

<?php
}
?>

<!-- End navColumnOne --></div>
<!-- end left --></div>

<!-- end content Main wrapper --></div>

<!-- begin bottom navigation -->
<div id="bottomnav">
    <div id="navSuppWrapper">
    <div id="navSupp">
    <ul>
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?> :: </a></li>
    <?php if (EZPAGES_STATUS_FOOTER == '1' or (EZPAGES_STATUS_FOOTER == '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])))) { ?>
    <li><?php require($template->get_template_dir('tpl_ezpages_bar_footer.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_ezpages_bar_footer.php'); ?></li>
    <?php } ?>
    </ul>
    </div>
    <!-- end navSuppWrapper --></div>
<!-- end bottom navigation --></div>


<!-- end mainWrapper --></div>

<!-- begin footer -->
<div>

    <div id="copyright">
    <?php
    /**
    * prepares and displays footer output
    *
    */
    require($template->get_template_dir('tpl_footer.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_footer.php');?>
    <!-- end copyright --></div>

    <!-- Begin footer --><div id="footer">
    <!--bof- parse time display -->
    <?php
    if (DISPLAY_PAGE_PARSE_TIME == 'true') {
    ?>
    <div class="smallText center">Parse Time: <?php echo $parse_time; ?> - Number of Queries: <?php echo $db->queryCount(); ?> - Query Time: <?php echo $db->queryTime(); ?></div>

    <?php
      }
    ?>
    <!--eof- parse time display -->
    <!--bof- banner #6 display -->
    <?php
    if (SHOW_BANNERS_GROUP_SET6 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET6)) {
    if ($banner->RecordCount() > 0) {
    ?>
    <div id="bannerSix" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
        }
      }
    ?>
    <!--eof- banner #6 display -->
    <!-- end bottom --></div>

<!-- End container -->
</div>
</div>
</body>

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

15 Dec 2008, 7:32 PM
#194
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

Just to complete the code review please see the add for colors.css

/* Background Layout (Smart Background app - added 12142008)*/
#logoWrapper { background-image: url(../images/smartbg.jpg); background-repeat: no-repeat; }
.smartBG_aboutus #logoWrapper { background-image: url(../images/smartbg_aboutus.jpg); background-repeat: no-repeat; }

#navMain.login { background-image: url(../images/topmenubg_login.jpg); background-repeat: no-repeat; }
#navMain.noLogin { background-image: url(../images/topmenubg.jpg); background-repeat: no-repeat; }
.smartBG_aboutus #navMain.login { background-image: url(../images/topmenubg_login_aboutus.jpg); background-repeat: no-repeat; }
.smartBG_aboutus #navMain.noLogin { background-image: url(../images/topmenubg_aboutus.jpg); background-repeat: no-repeat; }
```See also change in code in layout.css

/* Changed logowrapper and move part to colors.css - smartbackground application /
#logoWrapper { width: 100%; height: 153px; position: relative; }
/
end change */

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

15 Dec 2008, 8:05 PM
#195
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

OK, found one problem - It is the problem we are having with the use of jpg and gif for our images.

I just came to the realization that in colors.css we were using jpg for the login/logout images and we should be using gif. So, I corrected that problem and we now have the correct image on the home page etc.

Corrected login/logout jpg to gif to match image files.

#navMain.login { background-image: url(../images/topmenubg_login.gif); background-repeat: no-repeat; }
#navMain.noLogin { background-image: url(../images/topmenubg.gif); background-repeat: no-repeat; }
.smartBG_aboutus #navMain.login { background-image: url(../images/topmenubg_login_aboutus.gif); background-repeat: no-repeat; }
.smartBG_aboutus #navMain.noLogin { background-image: url(../images/topmenubg_aboutus.gif); background-repeat: no-repeat; }
```However, we still do not see the new images for the about_us page.  We get the same images as the home page.

Sawhorse

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

15 Dec 2008, 8:18 PM
#196
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

Later I found a similar problem in tpl_main_page.php but no change was seen in image for about_us page. Home page remained unchanged. I changed (about line 92) 'topmenubg_login.jpg' to gif and 'topmenubg.jpg' to gif.

Corrected login/logout jpg to gif to match image files.

    <!-- begin top navigation -->    

<?php

     if (STORE_STATUS == '0' and !$_SESSION['customer_id']) { 

            $menubg = 'topmenubg_login.gif';

     } else {

            $menubg = 'topmenubg.gif';

     } 

?> 

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

15 Dec 2008, 8:31 PM
#197
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

While I was on the about_us page using Firebug I saw

<body id="aboutusBody" class="smartBG"> but the images were not correct for the about_us page.

Sawhorse

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

15 Dec 2008, 8:56 PM
#198
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

On an earlier post you suggest.

 <?php if ($_SESSION['customer_id']) { 
                        
                        $menubg = 'topmenubg_';
                        
              } else {
                if (STORE_STATUS == '0') {
                    
                    $menubg = 'topmenubg_login_';
                    
        } } ?>

<?php //Smart Backgrounds - for foreground logo - 20081212
$smart_image = '';
$unique_ezpages = true;//change to false to not have diff bg for each ezpage
if ($current_page_base == 'index' or $current_page_base == 'product_info') { //change filename to $menubg and top cat id only if cat image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . $menubg . str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath]) . '.gif'))?$menubg . str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath] . '.gif'):'.gif';
} elseif ($current_page_base == 'page' and $unique_ezpages == true) { //change filename to $menubg_page and ez-page id only if ez-page image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . $menubg . 'page' . $_GET[id] . '.gif'))?$menubg . 'page' . $_GET[id] . '.gif':'.gif';
} else { //change filename to $menubg and pagename only if  page image exists
  $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . $menubg . $current_page_base . '.gif'))?$menubg . $current_page_base . '.gif':'.gif'; //default/home page image will be as defined ($menubg.gif)
}// /Smart Backgrounds

$menubg .= $smart_image;?>  
```**Later:**

> **gjh42:**
>
> ```php
<?php if ($_SESSION['customer_id']) { 
                        
                        $menubg = 'topmenubg.jpg';
                        
              } else {
                if (STORE_STATUS == '0') {
                    
                    $menubg = 'topmenubg_login.jpg';
                    
        } } 
?> 
```I am not sure this logic will always do what you want.
> If there is a logged-in customer, you get 'topmenubg.jpg'.
> Otherwise if store status is 0 (regular store), you get 'topmenubg_login.jpg'.
> If store status is anything else, you get no background image at all.
> 
> Try a strict either/or:```php
<?php
     if (STORE_STATUS == '0' and !$_SESSION['customer_id']) { 
            $menubg = 'topmenubg_login.jpg';
     } else {
            $menubg = 'topmenubg.jpg';
     } 
?> 
```The only time you want the login bg is if it is a regular store with no logged-in customer.
> 
> Now scrap the filenames so the stylesheet can handle all the permutations. Build a class name instead, and add that to the #navMain div:```php
<?php
     if (STORE_STATUS == '0' and !$_SESSION['customer_id']) { 
            $menuclass = 'login';
     } else {
            $menuclass = 'noLogin';
     } 
?>
<div id="navMain" class="<?php echo $menuclass;?>"> 

If you look in my tpl_main_page.php (about line 94) you will see that I only have the later code with the change from jpg to gif.
[quote=gjh42;656150]```php
Try a strict either/or:[php]<?php if (STORE_STATUS == '0' and !$_SESSION['customer_id']) { $menubg = 'topmenubg_login.jpg'; } else { $menubg = 'topmenubg.jpg'; } ?>


Sawhorse

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com

15 Dec 2008, 11:02 PM
#199
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Smart Backgrounds support

You do have the about us image in the right place with the right name:
/includes/templates/Series_12_Horses/images/smartbg_aboutus.jpg

so we need to find out why it is not getting that info. Add a debug line to tpl_main_page.php:

echo 'body: ' . $body_id . ' file search: ' . DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . $current_page_base . '.jpg';

in this section```php
} else { //add _ and page base to classname only if page bg image exists
$smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . $current_page_base . '.jpg'))?'_' . $current_page_base:''; //default/home page classname will be just .smartBG, and filename smartbg.jpg
}// /Smart Backgrounds?>

<body id="<?php echo $body_id . 'Body'; ?>" class="smartBG<?php echo $smart_image;?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>> ```to get this:```php } else { //add _ and page base to classname only if page bg image exists $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . $current_page_base . '.jpg'))?'_' . $current_page_base:''; //default/home page classname will be just .smartBG, and filename smartbg.jpg } echo 'body: ' . $body_id . ' file search: ' . DIR_WS_TEMPLATE_IMAGES . 'smartbg_' . $current_page_base . '.jpg'; // /Smart Backgrounds?> <body id="<?php echo $body_id . 'Body'; ?>" class="smartBG<?php echo $smart_image;?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>> ```
15 Dec 2008, 11:53 PM
#200
sawhorse avatar

sawhorse

Zen Follower

Join Date:
Oct 2007
Location:
Kentucky - USA
Posts:
425
Plugin Contributions:
0

Re: Smart Backgrounds support

Yes, I do have the about us image in the right place with the right name:/includes/templates/Series_12_Horses/images/smartbg_aboutus.jpg

I have added the debug line to tpl_main_page.php

Sawhorse

P.S. Now what happens? I have never done this?

ZC 1.3.8a; Addons: Admin Profiles, Ty Package Tracker; Swap Images via MouseOver or Click, Smart Backgrounds; Printable Price List; CSS buttons; Contact Us - Add Subject; Template: Self Constructed; Site: http://sawhorsejewelry.com