Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    241
    Plugin Contributions
    0

    Default What is the variable for the template directory?

    I want to use rollover images for the horizontal menu bar.

    This code works:
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '" onMouseover="MyLink1.src=\'includes/templates/menu-home-on.png\';" onMouseOut="MyLink1.src=\'includes/templates/menu-home-off.png\';">'; ?><img id="MyLink1" src="includes/templates/menu-home-off.png"></a></li>
    ...but I would prefer to use a variable so that the images could be stored in the working template folder and that this code could be used for other templates without changing the code.

    So - is there a simple variable I can drop in there that points to the MY_TEMPLATE directory?

  2. #2
    Join Date
    Mar 2004
    Posts
    16,042
    Plugin Contributions
    5

    Default Re: What is the variable for the template directory?

    Code:
    ' . zen_image($template->get_template_dir(YOUR IMAGE DEFINE HERE, DIR_WS_TEMPLATE, $current_page_base,'images'). '
    Zen cart PCI compliant Hosting

  3. #3
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    241
    Plugin Contributions
    0

    Default Re: What is the variable for the template directory?

    Thanks for this, but I can't get it to work inside 'onMouseover'

    I wish there was just simple variable that I could use for the template directory itself, like DIR_WS_TEMPLATE - but I guess not...

  4. #4
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: What is the variable for the template directory?

    You just follow the pattern:
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '"
    onMouseover="MyLink1.src=\'' . zen_image($template->get_template_dir( 'menu-home-on.png', DIR_WS_TEMPLATE, $current_page_base, 'images') . '/menu-home-on.png\'"
    onMouseOut="MyLink1.src=\'' . zen_image($template->get_template_dir( 'menu-home-off.png', DIR_WS_TEMPLATE, $current_page_base, 'images') . '/menu-home-off.png\'">
    <img id="MyLink1" src="' . zen_image($template->get_template_dir( 'menu-home-off.png', DIR_WS_TEMPLATE, $current_page_base, 'images') . '/menu-home-off.png'; ?>">
    </a></li>


    Using this approach allows it to check for the override image for *each* image, not just a check to see which template is active. That way if the image is missing, it can fall back to the default.
    .

    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.

  5. #5
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    241
    Plugin Contributions
    0

    Default Re: What is the variable for the template directory?

    That code gave me an error.

    I'm finally using the following code and it seems to work:

    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '" onMouseover="MyLink1.src=\'' . zen_output_string($template->get_template_dir('menu-home-on.png', DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . 'menu-home-on.png') . '\';" onMouseout="MyLink1.src=\'' . zen_output_string($template->get_template_dir('menu-home-off.png', DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . 'menu-home-off.png') . '\';"><img id="MyLink1" src="' . zen_output_string($template->get_template_dir('menu-home-off.png', DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . 'menu-home-off.png') . '"'?></a></li>

 

 

Similar Threads

  1. Replies: 12
    Last Post: 27 Jul 2016, 12:20 AM
  2. what is the variable for the contact_us page?
    By nwms8 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 21 Jul 2010, 07:55 AM
  3. What is the variable that represents the selected currency?
    By cochlear in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 6 Jul 2008, 02:33 PM
  4. What is the variable for specials
    By kands in forum General Questions
    Replies: 2
    Last Post: 11 May 2007, 08:38 PM
  5. What is the variable's name for Total?
    By kinethic in forum Managing Customers and Orders
    Replies: 2
    Last Post: 27 Jul 2006, 01:56 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