Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2011
    Posts
    9
    Plugin Contributions
    0

    Default Proper procedure for referencing images in overridden files?

    I am overriding the products page in my own template via:
    /includes/templates/[TEMPLATE NAME]/templates/tpl_product_info_display.php

    I want to include a link to another page on the site via an image of a gnome

    I want to keep my file system clean in case someone else may have to edit this stuff later, I would like them to think that i did things correctly.

    My question is how should i link to the image? If i store it in:
    /includes/templates/[TEMPLATE NAME]/images

    then put this in the html
    <img src="/includes/templates/[TEMPLATE NAME]/images/gnome.gif" alt="Gnome" />
    If they change the name of the template it will not show up properly, any suggestions or if you just think I am over thinking this would be great

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Proper procedure for referencing images in overridden files?

    If they change the name of the template it will not show up properly
    So do you want it to show with another template?

    If so, the file & image should also go with the other template
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Jun 2011
    Posts
    9
    Plugin Contributions
    0

    Default Re: Proper procedure for referencing images in overridden files?

    I just dont want it to stop working if I change the template name, for example if I start a new site and want to use my same layout.

  4. #4
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: Proper procedure for referencing images in overridden files?

    Use Zen Cart default code:

    <?php echo zen_image(DIR_WS_TEMPLATES . $template_dir . '/images/image_name.gif','alt text for image'); ?>

    Change the parts in Bold to match your needs.

    The above looks for images based on the current Template being used. Make sure though, you have the image available if/when you change Templates.


    Also, do not start a path with a forward slash.

    /includes << bad

    includes << good

    You will find things work better.
    Last edited by Website Rob; 13 Jun 2011 at 07:06 AM.

  5. #5
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Proper procedure for referencing images in overridden files?

    I just dont want it to stop working if I change the template name, for example if I start a new site and want to use my same layout.
    You will have to pull/copy your template specific modified files to any new template you create
    Zen-Venom Get Bitten

  6. #6
    Join Date
    Jun 2011
    Posts
    9
    Plugin Contributions
    0

    Default Re: Proper procedure for referencing images in overridden files?

    Quote Originally Posted by Website Rob View Post
    Use Zen Cart default code:

    <?php echo zen_image(DIR_WS_TEMPLATES . $template_dir . '/images/image_name.gif','alt text for image'); ?>
    This is exactly what i was looking for this should work perfectly

 

 

Similar Threads

  1. what is the proper folder for storing images?
    By idc1 in forum General Questions
    Replies: 3
    Last Post: 11 Jul 2011, 02:20 PM
  2. What is the proper procedure for changing to Dedicated Server and upgrade zencart?
    By musicfreer in forum Upgrading from 1.3.x to 1.3.9
    Replies: 11
    Last Post: 12 Jan 2011, 05:32 AM
  3. referencing images in stylesheet
    By MoooNDawG in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 18 Jul 2008, 04:07 PM

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