Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2009
    Posts
    128
    Plugin Contributions
    0

    Default tpl_header.php how to set different logos for each language?

    Hi,

    I have two languages and I'd like to set different logos image for each language.
    I tried to modify header.php in each language directory dut it doesn't work since the logo is set in themes/CUSTOM/common/tpl_header.php

    How could I make this possible? the t/l_header.php is not inside any language folder, so do I need to change the code? How?

    Thank you very much for your support, here you are the piece of code of tpl_header.php:

    PHP Code:
    <a href="<?php echo zen_href_link(FILENAME_DEFAULT);?>"><?php echo zen_image(DIR_WS_TEMPLATE.'images/logo.gif'); ?>

  2. #2
    Join Date
    Jan 2004
    Posts
    66,374
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: tpl_header.php how to set different logos for each language?

    Well, the original Zen Cart template contains language-dependent coding for the logo by calling HEADER_LOGO_IMAGE instead of 'images/logo.gif' specifically. Thus, your language files can contain the definition for HEADER_LOGO_IMAGE, and that way your template can be language-independent.
    Code:
        <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>
    Alternatively, if your template contains numerous additional very-language-specific components, you could have a separate template for each language, and simply enable those separate templates in your Admin->Tools->Template Select screen. But this is RARELY needed, and I usually only see people do this when supporting both RTL and LTR languages.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: tpl_header.php how to set different logos for each language?

    This is what I have done in the past...

    The HEADER area also allows for a BACKGROUND IMAGE, which can be defined in the stylesheet:

    #logoWrapper

    So you could create your "logos" as a background images and add:

    --------------------------------------------------------------------

    #logoWrapper {
    background: #fff url(../images/logo-english.jpg) no-repeat left top;
    }
    ... to a language stylesheet for ENGLISH (english_stylesheet.css)


    --------------------------------------------------------------------

    #logoWrapper {
    background: #fff url(../images/logo-french.jpg) no-repeat left top;
    }
    ... to a language stylesheet for FRENCH (french_stylesheet.css)


    --------------------------------------------------------------------

    #logoWrapper {
    background: #fff url(../images/logo-spanish.jpg) no-repeat left top;
    }
    ... to a language stylesheet for SPANISH (spanish_stylesheet.css)


    --------------------------------------------------------------------

    THEN...

    Just create a 1 pixel X 1 pixel transparent GIF for your logo.gif image (as it will no longer be needed as the actual logo, but is still needed as an image is "expected")

    If you use JPG for your logo image, then choose a "neutral colour" for that single pixel, and save it as logo.jpg

    If you use PNG, then you can do the same as for GIF, bu making the PNG transparent.
    20 years a Zencart User

  4. #4
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: tpl_header.php how to set different logos for each language?

    Dr Byte's suggestion is preferable - but as he says... if your template has HARD CODED to image path, rather than using the DEFINE, you will have a problem.
    20 years a Zencart User

  5. #5
    Join Date
    Aug 2009
    Posts
    128
    Plugin Contributions
    0

    Default Re: tpl_header.php how to set different logos for each language?

    That worked perfectly, thank you very much!

    Quote Originally Posted by DrByte View Post
    Well, the original Zen Cart template contains language-dependent coding for the logo by calling HEADER_LOGO_IMAGE instead of 'images/logo.gif' specifically. Thus, your language files can contain the definition for HEADER_LOGO_IMAGE, and that way your template can be language-independent.
    Code:
        <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>
    Alternatively, if your template contains numerous additional very-language-specific components, you could have a separate template for each language, and simply enable those separate templates in your Admin->Tools->Template Select screen. But this is RARELY needed, and I usually only see people do this when supporting both RTL and LTR languages.

 

 

Similar Threads

  1. now in your cart in another language (tpl_header.php)
    By cinziapdl in forum Addon Language Packs
    Replies: 12
    Last Post: 10 Feb 2012, 12:31 AM
  2. How to change logos for different users?
    By NWFAP in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 29 Dec 2011, 09:07 AM
  3. How to set different shipping cost for each product?
    By stanlee in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 17 Mar 2009, 02:45 PM
  4. Replies: 1
    Last Post: 9 Oct 2007, 10:30 AM
  5. How to set a default country per language for multi language sites
    By lacabessa in forum Addon Language Packs
    Replies: 2
    Last Post: 18 Nov 2006, 11:00 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR