Results 1 to 10 of 393

Hybrid View

  1. #1
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Smart Backgrounds support

    For the case of foreground image switching, this from the v3.0 readme tells how to use it:

    ----------------------------------------------------------------------------------------------
    To switch Foreground images instead of Backgrounds:

    Call the smart_backgrounds() function from any file where page-dependent coding is desired.
    Include string arguments if you want to use other than '.gif' images or look for other than 'bg' files.


    <?php echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'smartsidebox' . smart_backgrounds('.jpg','sidebox') . '.jpg', 'Your alt text');?>

    will output

    <img src="http://yourdomain.com/includes/templates/your_template/images/smartsidebox_page5.jpg" alt="Your alt text">

    on ez-page id 5 if smartsidebox_page5.jpg exists. Combine this with an "if" statement

    $smart_image = smart_backgrounds('.jpg','sidebox');
    if ($smart_image == '_page5') {
    echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'smartsidebox' . $smart_image . '.jpg', 'Your alt text');
    }

    to show the content only on ez-page id 5 if smartsidebox_page5.jpg exists.

    if (substr_count($smart_image,'_page')) {
    echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'smartsidebox' . $smart_image . '.jpg', 'Your alt text');
    }

    will show the content on any ez-page if an appropriate smartsidebox_page.jpg file exists.
    Name and save images as described above.
    For foreground images, you do not need to make individual stylesheet rules.
    ----------------------------------------------------------------------------------------------

    You could use
    PHP Code:
    <?php echo zen_image(DIR_WS_TEMPLATE_IMAGES 'smartlogo' smart_backgrounds('.jpg','logo') . '.jpg''Your alt text');?>
    with images like smartlogo_13_27.jpg to give a custom logo for subcategory cPath 13_27.

  2. #2
    Join Date
    Sep 2008
    Posts
    9
    Plugin Contributions
    0

    Default Re: Smart Backgrounds support

    Glenn,

    Thank you for the quick feedback. I'll check out the 3.0 code and make it work.

    cfs

  3. #3
    Join Date
    Sep 2008
    Posts
    9
    Plugin Contributions
    0

    Default Re: Smart Backgrounds support

    Still having a bit of trouble.

    The images I am trying to vary are the logo images. Looking over the code in 3.0, I revised my branding section of tpl_header.php to include the following:

    Code:
    <!--bof-branding display-->
    
    <tr align="right">
    <td>
    
    
    <div id="lwrapper">
    
    <div id="logo">
    
    <?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'smartimg' . smart_backgrounds('.jpg','img') . '.jpg', HEADER_ALT_TEXT, HEADER_LOGO_WIDTH, HEADER_LOGO_HEIGHT) . '</a>'; ?></div>
        
    <br class="clearBoth" />
    </div>
    
    </td>
    </tr>
    
    
    <!--eof-branding display-->
    It hangs up the site completely. Something is not working with

    smart_backgrounds('.jpg','img')

    I've got it working with the function removed from the code.

  4. #4
    Join Date
    Sep 2008
    Posts
    9
    Plugin Contributions
    0

    Default Re: Smart Backgrounds support

    Ok, it's not hanging up if the smart_backgrounds_functions is in the /includes/functions/extra_functions folder

    if it is in
    /includes/functions/extra_functions/mytemplate/

    it hangs up.

    Even so, while it is working, I cannot get it to report back a value other than null, regardless of the page I am on.

    Color me confused.

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Smart Backgrounds support

    What image names do you have, and where are they saved?
    You do want a base image named (in this case) smartimg.jpg, for display when there is no specific image matching a page. If there is no match, the function will return null, and the base name and extension will be used.

    There is no template override available in /includes/functions/, so
    /includes/functions/extra_functions/smart_backgrounds_functions.php as the readme describes is correct. The zip has the extra folder. I have corrected this and reposted the zip.
    Last edited by gjh42; 10 Feb 2010 at 06:14 PM.

  6. #6
    Join Date
    Sep 2008
    Posts
    9
    Plugin Contributions
    0

    Default Re: Smart Backgrounds support

    Quote Originally Posted by gjh42 View Post
    What image names do you have, and where are they saved?
    You do want a base image named (in this case) smartimg.jpg, for display when there is no specific image matching a page. If there is no match, the function will return null, and the base name and extension will be used.
    Image names are like this
    smartimg.jpg
    smartimg_11.jpg
    smartimg_shippinginfo.jpg
    etc.

    Images are saved in includes/templates/custom/images/

    The function is returning null regardless of the page I am on, so the base image is the only one displayed. So the code is working, it's just that the function is returning null regardless.

    I guessed that there shouldn't be an override, since the site locked every time I tried to use the function in the override folder.
    Last edited by cfsheridan; 10 Feb 2010 at 03:15 PM.

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Smart Backgrounds support

    This is a bit annoying. I threw the not-yet-tested 3.0 zip up in another thread with a request to let me know about any problems. 33 people downloaded it, but not one came back with a question.

    Moving the code from tpl_main_page to a function broke it, as $current_page_base is not available inside a function without special arrangements. $_GET['main_page'] is available everywhere, so I have switched the function to use that, and it now works correctly. I have also improved the readme with a note about the base image for foreground image switching.
    Last edited by gjh42; 16 Feb 2010 at 08:39 AM.

 

 

Similar Threads

  1. Adding Image Map to header with Smart Backgrounds
    By cspan27 in forum Addon Templates
    Replies: 16
    Last Post: 25 Jul 2009, 01:14 AM
  2. smart backgrounds
    By Glendon in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 11 Sep 2008, 04:49 PM
  3. Backgrounds
    By v.kirk in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 23 Jun 2006, 06:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg