Page 29 of 40 FirstFirst ... 19272829303139 ... LastLast
Results 281 to 290 of 393
  1. #281
    Join Date
    Jul 2009
    Location
    Prague, Czech Republic
    Posts
    530
    Plugin Contributions
    0

    Default Re: Smart Backgrounds support

    Quote Originally Posted by gjh42 View Post
    Since you have done so much since you first posted, it is hard to tell what some of your comments refer to.
    Sorry, yes, I realise that That's the trouble with the seven minute limit on editing sometimes


    Quote Originally Posted by gjh42 View Post
    TM templates are usually much harder to customize the style of, since they have lots of extra nested divs, sometimes tables, and renamed standard elements, sometimes with standard distinction abilities removed.
    Tell me about it LOL. I'll take a look at the navCatTabsWrapper padding later today when I get time



    Thanks for the reply Glenn, and it's a great little MOD btw

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

    Default Re: Smart Backgrounds support

    I've read most of the thread, and managed to get the foreground image code working, to vary between different logo foreground images. I've tried several times to replace the current code that is in tpl_header.php to get images to work with subcategories, using the bg image code, modified for use with foreground images and with .jpg

    Base code (works, but no subcatagories)
    Code:
    if ($current_page_base == 'index' or $current_page_base == 'product_info') { //change filename to smartimg_ and top cat id only if cat image exists
      $smart_image = (file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartimg_' . str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath]) . '.jpg'))?'smartimg_' . str_replace(strstr($_GET[cPath],'_'),'',$_GET[cPath] . '.jpg'):HEADER_LOGO_IMAGE;
    Attempted code (no images show)
    Code:
     if ($current_page_base == 'index' or $current_page_base == 'product_info') { //add _ and cPath to img filename only if individual cat img image exists, else add _ and top cat id to img filename only if top cat img image exists
      $smart_image = file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartimg_' . $_GET[cPath] . '.jpg')?'_' . $_GET[cPath]:(file_exists(DIR_WS_TEMPLATE_IMAGES . 'smartimg_' . (int)$_GET[cPath] . '.jpg')?'_' . (int)$_GET[cPath]:'');
    Any help or ideas would be most appreciated.

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

    Default Re: Smart Backgrounds support

    It looks like you are using code from v2.0 or earlier. This has been improved even in the currently available v2.1.1 to allow indifidual subcategory control, and v3.0 radically changes the method of use to be much simpler and more flexible.

    With mod submissions and updates sometimes taking two months or more to be approved these days, I had forgotten that I had not actually submitted it yet, and the thread where I did attach the zip is obscure enough that only 33 people had downloaded from there. Since I have heard no questions from them about how to make it work, I will assume that they have not found any bugs, and proceed to submit the update. Until it is approved, I will move the attachment to this thread.
    Last edited by gjh42; 10 Feb 2010 at 08:59 AM.

  4. #284
    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.

  5. #285
    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

  6. #286
    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.

  7. #287
    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.

  8. #288
    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.

  9. #289
    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.

  10. #290
    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.

 

 
Page 29 of 40 FirstFirst ... 19272829303139 ... LastLast

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