Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Add image to header.tpl file

Add image to header.tpl file

Views: 3,203

Results 1 to 8 of 8
12 Nov 2012, 11:28 PM
#1
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Add image to header.tpl file

Hi. I want to add an additional image to my header (in between my logo and my search box to the right). Normally and in the past, I would/have just added some html to my tpl_header.php page where I want the logo to appear. Then add the style to my stylesheet. This is what I am thinking:

<div id="midheader"><img src="../images/MYIMAGE.gif" width="100" height="60" alt="Mid Header"></div>

But I am now wondering, if this would be the best practice to just add html to the .tpl php page? Plus, I am running both SSL and non SSL so I am a little worried about that image not showing correctly on each page (if I hard link). The image is in my images folder in my current loaded template. Is this the correct context? I see an aweful lot of syntax that is written in .php (which I am not good at) that looks like this:

<img src="<?php  echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.HEADER_ICON_CART ?>" alt="cart icon" class="cart-icon"  />

I can get the text in the right area of the tpl_header.php file. And I can figure out how to style it. I am just concerned with the coding I need to add the the tpl_header.php file. Am I OK with the concept of the coding above for this page?

12 Nov 2012, 11:51 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Add image to header.tpl file

<div id="midheader"><img src="../images/MYIMAGE.gif" width="100" height="60" alt="Mid Header"></div>

img src=".. should handle http or https

13 Nov 2012, 6:07 AM
#3
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Re: Add image to header.tpl file

OK so adding this text on the .tpl page will not be an issue. I have done it in the past, but was just wondering if it was not good practice. Thank you.

13 Nov 2012, 6:46 AM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Add image to header.tpl file

OK so adding this text on the .tpl page will not be an issue
Just use the template override system

13 Nov 2012, 2:11 PM
#5
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Re: Add image to header.tpl file

The image URL is not correct so it is not directing to my template folder. I have this coding:

<div id="midheader"><img src="../images/midheader.png" alt="Best of Cincinnati Award"></div>

When I look at the source of the page, I see this:

<div id="midheader"><img src="[URL="http://www.zen-cart.com/view-source:http://www.lasilhouettelingerie.com/images/midheader.png"]../images/midheader.png[/URL]" alt="Best of Cincinnati Award"></div>

I am sorry for such a simple question, but how do I make this URL direct to my images folder (without putting in the whole URL)?

13 Nov 2012, 5:45 PM
#6
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Add image to header.tpl file

Oh your cart is in a folder....

Try

<div id="midheader"><img src="../store/images/midheader.png" alt="Best of Cincinnati Award"></div>
13 Nov 2012, 8:25 PM
#7
sports_guy avatar

sports_guy

Totally Zenned

Join Date:
Apr 2007
Location:
Dayton, Ohio
Posts:
682
Plugin Contributions:
0

Re: Add image to header.tpl file

Ohhh I see. I am supposed to put the image in the root image folder as the base of my shop. I was keeping the image in my customized template image folder. I just put the full URL with the https, so it will show in the non-SSL store; and when I go to the SSL store my users do not get the security notification. The way I do it now it shows my template folder in the source code. But I noticed the URL gives away the template location anyway, for other generated images as well.

13 Nov 2012, 8:45 PM
#8
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Add image to header.tpl file

That is what the php does - points to the template/images folder

DIR_WS_TEMPLATE, $current_page_base,'images')