If this is your first visit, check our documentation. To post, register or login.
Forums / Templates, Stylesheets, Page Layout / centering header image with tpl_header.php

centering header image with tpl_header.php

Locked

Started by praiseandplay on 29 Jul 2006, 7:19 PM · Views: 4,923

Results 1 to 20 of 22
This thread is locked. New replies are disabled.
29 Jul 2006, 7:19 PM
#1
praiseandplay avatar

praiseandplay

New Zenner

Join Date:
Jul 2006
Posts:
49
Plugin Contributions:
0

centering header image with tpl_header.php

I've read a lot of the posts on this site about centering the header image, and almost all of them say to edit the table properties located in the tpl_header.php file. The problem that I am having is that there are no table properties in my tpl_header.php file, and was curious as to whether or not there would be any other way to center it?

29 Jul 2006, 8:12 PM
#2
graper avatar

graper

New Zenner

Join Date:
Jul 2006
Posts:
50
Plugin Contributions:
0

Re: centering header image with tpl_header.php

As far as I could tell, you probably want to use CSS and change the properties of #mainWrapper so that everything on the page is centered.

If you are just concerned about the header, change the properties of #headerWrapper.

Granville [granville (at) kirkhamsystems.com]
Kirkham Systems, Inc.

29 Jul 2006, 8:46 PM
#3
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,747
Plugin Contributions:
0

Re: centering header image with tpl_header.php

Actually I think you will want to change the #logo from float: left to margin: auto;.

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

29 Jul 2006, 8:48 PM
#4
praiseandplay avatar

praiseandplay

New Zenner

Join Date:
Jul 2006
Posts:
49
Plugin Contributions:
0

Re: centering header image with tpl_header.php

Thank you for the reply. I did try your suggestion by adding the line text-align: center to #headerWrapper. It aligns the text on my page just fine but not the header image. Not really sure what to do know. I got my tpl_header from template_default_common, and since i cannot edit that file because there are no tables, i have no idea what to do now.

29 Jul 2006, 10:02 PM
#5
praiseandplay avatar

praiseandplay

New Zenner

Join Date:
Jul 2006
Posts:
49
Plugin Contributions:
0

Re: centering header image with tpl_header.php

Kim, I finally got it due to the fact you had mentioned the logo class. I added text-align: center to #logo instead of where I had before, and that worked now I just have about a 1/2 inch of space at the bottom of my logo, and have no idea on how to get rid of it? At least the image is now centered which was a big headache.

29 Jul 2006, 10:36 PM
#6
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,747
Plugin Contributions:
0

Re: centering header image with tpl_header.php

The URL of your site?

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

31 Jul 2006, 8:49 PM
#9
kirsten avatar

kirsten

New Zenner

Join Date:
Jul 2006
Posts:
74
Plugin Contributions:
0

Re: centering header image with tpl_header.php

I am sooo blind when it comes to all this.. and not that GREAT for HTML..
Can someone tell me in english how to make my "logo" centered?

I Tried what you all were speaking of.. but I don't think I get it.

here is my site.. http://www.kandiesforyou.com/shop

Thanks so much

http://www.kandiesforyou.com
Learning more and more everyday with the Zen-cart family

31 Jul 2006, 10:20 PM
#10
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Re: centering header image with tpl_header.php

Kirsten - I just looked at yours again and I see why yours won't center.

You are using classic template - you need to look in /includes / templates / classic / common/tpl_header.php

You will see in there that your logo is contained in a table that is set to be 200px wide. If you remove the sizing on that your logo will center (change to width="200" to width="100%" or else remove it entirely)

Hope that helps get you going again :)

When the world gets in my face I say Have A Nice Day.

31 Jul 2006, 11:50 PM
#11
kirsten avatar

kirsten

New Zenner

Join Date:
Jul 2006
Posts:
74
Plugin Contributions:
0

Re: centering header image with tpl_header.php

I Did that.. and when I "Edit" the tpi_head.php

This is the ONLY stuff in there

<?php // // +----------------------------------------------------------------------+ // |zen-cart Open Source E-commerce | // +----------------------------------------------------------------------+ // | Copyright (c) 2003 The zen-cart developers | // | | // | <http://www.zen-cart.com/index.php> | // | | // | Portions Copyright (c) 2003 osCommerce | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.0 of the GPL license, | // | that is bundled with this package in the file LICENSE, and is | // | available through the world-wide-web at the following url: | // | <http://www.zen-cart.com/license/2_0.txt>. | // | If you did not receive a copy of the zen-cart license and are unable | // | to obtain it through the world-wide-web, please send a note to | // | [[email protected]](mailto:[email protected]) so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // $Id: tpl_box_header.php 2625 2005-12-20 02:13:19Z drbyte $ // ?> <div><?php echo $content; ?></div>

http://www.kandiesforyou.com
Learning more and more everyday with the Zen-cart family

1 Aug 2006, 12:00 AM
#12
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Re: centering header image with tpl_header.php

that is tpl_BOX-header:no:

You need tpl_header.php:yes:

When the world gets in my face I say Have A Nice Day.

1 Aug 2006, 12:26 AM
#13
kirsten avatar

kirsten

New Zenner

Join Date:
Jul 2006
Posts:
74
Plugin Contributions:
0

Re: centering header image with tpl_header.php

Am I blind??? I Can't find it.. the Logo part that I need to change....

<?php /** * Common Template - tpl_header.php * * this file can be copied to /templates/your_template_dir/pagename<br /> * example: to override the privacy page<br /> * make a directory /templates/my_template/privacy<br /> * copy /templates/templates_defaults/common/tpl_footer.php to /templates/my_template/privacy/tpl_header.php<br /> * to override the global settings and turn off the footer un-comment the following line:<br /> * <br /> * $flag_disable_header = true;<br /> * * @package templateSystem * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: tpl_header.php 3192 2006-03-15 22:37:24Z wilt $ */ // Display all header alerts via messageStack: if ($messageStack->size('header') > 0) { echo $messageStack->output('header'); } ?>
<table class="centershop" border="0" cellspacing="0" cellpadding="0">
<?php if (!isset($flag_disable_header) || $flag_disable_header == false) { ?>
  <tr><td>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="headerNavigation">
      <tr>
        <td align="left" valign="top" width="35%" class="headerNavigation">
          <a href="<?php echo zen_href_link(FILENAME_DEFAULT, '', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CATALOG; ?></a> | 
<?php if (isset($_SESSION['customer_id'])) { ?>
          <a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a> | 
          <a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>
<?php } else { if (STORE_STATUS == '0') { ?>
          <a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a>
<?php } } ?>
        </td>
        <td align="center" width="30%" class="headerNavigation"><?php require(DIR_WS_MODULES . 'sideboxes/' . 'search_header.php'); ?></td>
        <td align="right" valign="top" width="35%" class="headerNavigation">
<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
          <a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> | <a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?>»</a>
<?php }?>
        </td>
      </tr>
    </table>
    <table border="0" width="100%" cellspacing="0" cellpadding="0" class="header">
      <tr><!-- All HEADER_ definitions in the columns below are defined in includes/languages/english.php //-->
        <td valign="middle" height="<?php echo HEADER_LOGO_HEIGHT; ?>" width="<?php echo HEADER_LOGO_WIDTH; ?>">
<?php echo '<a href="' . zen_href_link(FILENAME_DEFAULT) . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . '</a>'; ?>
        </td>
        <td align="center" valign="top">
<?php if (HEADER_SALES_TEXT != '') { echo HEADER_SALES_TEXT; } if (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2)) { if ($banner->RecordCount() > 0) { echo zen_display_banner('static', $banner); } } ?>
        </td>
      </tr>
    </table>
<?php if (isset($_GET['error_message']) && zen_not_null($_GET['error_message'])) { ?>
    <table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr class="headerError">
        <td class="headerError"><?php echo htmlspecialchars(urldecode($_GET['error_message'])); ?></td>
      </tr>
    </table>
<?php } if (isset($_GET['info_message']) && zen_not_null($_GET['info_message'])) { ?>
    <table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr class="headerInfo">
        <td class="headerInfo"><?php echo htmlspecialchars($_GET['info_message']); ?></td>
      </tr>
    </table>
<?php } ?> <?php } else { ?>
<tr><td>
<?php } ?> <!--bof-optional categories tabs navigation display--> <?php if (CATEGORIES_TABS_STATUS == '1') { require($template->get_template_dir('tpl_modules_categories_tabs.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_categories_tabs.php'); } ?> <!--eof-optional categories tabs navigation display--> <!--bof-header ezpage links--> <?php if (EZPAGES_STATUS_HEADER == '1' or (EZPAGES_STATUS_HEADER == '2' and (strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])))) { ?> <?php require($template->get_template_dir('tpl_ezpages_bar_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_ezpages_bar_header.php'); ?> <?php } ?> <!--eof-header ezpage links-->

By The way Tina you are funny:lol:

http://www.kandiesforyou.com
Learning more and more everyday with the Zen-cart family

1 Aug 2006, 12:30 AM
#14
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Re: centering header image with tpl_header.php

Hun if it were me I would edit this :

<td valign="middle" height="<?php echo HEADER_LOGO_HEIGHT; ?>" width="<?php echo HEADER_LOGO_WIDTH; ?>"> <?php echo '<a href="' . zen_href_link(FILENAME_DEFAULT) . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . '</a>'; ?> </td> <td align="center" valign="top"> <?php if (HEADER_SALES_TEXT != '') { echo HEADER_SALES_TEXT; } if (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2)) { if ($banner->RecordCount() > 0) { echo zen_display_banner('static', $banner); } } ?> </td>

To Read THIS :

<td valign="middle" height="<?php echo HEADER_LOGO_HEIGHT; ?>" width="<?php echo HEADER_LOGO_WIDTH; ?>"> <?php echo '<a href="' . zen_href_link(FILENAME_DEFAULT) . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . '</a>'; ?> </td>

But that's me - I don't use the tagline or header banners so it's the first thing I edit out :)

That is the part that you need to edit though;)

When the world gets in my face I say Have A Nice Day.

1 Aug 2006, 1:37 AM
#16
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Re: centering header image with tpl_header.php

IGNORE MY POST THERE !!
Sorry - I didn't put back all that is needed in that code Kristen - I am sending you the fixed file!

It was a too fast reply and oops :(

When the world gets in my face I say Have A Nice Day.

1 Aug 2006, 1:44 AM
#17
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Re: centering header image with tpl_header.php

Kirsten I have it fixed for you - here you go - just upload this one instead of your tpl_header.php file

I am really sorry about that !

When the world gets in my face I say Have A Nice Day.

1 Aug 2006, 1:58 AM
#18
kirsten avatar

kirsten

New Zenner

Join Date:
Jul 2006
Posts:
74
Plugin Contributions:
0

Re: centering header image with tpl_header.php

Its ok.. just delete me why dont' ya. LOL :D

By the way: I e-mailed this to you.. but I thought I would post it here as well. For future ref.

Do you know why my Background ONLY goes half way down? Do you notice that ?

http://www.kandiesforyou.com

http://www.kandiesforyou.com
Learning more and more everyday with the Zen-cart family

1 Aug 2006, 2:03 AM
#19
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Re: centering header image with tpl_header.php

I think it's cuz you have the repeat-x in the css - if you remove that part does it fix ?

When the world gets in my face I say Have A Nice Day.

1 Aug 2006, 3:23 AM
#20
kirsten avatar

kirsten

New Zenner

Join Date:
Jul 2006
Posts:
74
Plugin Contributions:
0

Re: centering header image with tpl_header.php

The one that you originally told me to remove? I did that.

http://www.kandiesforyou.com
Learning more and more everyday with the Zen-cart family