Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Centering the heading logo


elvisparsely

Recommended Posts

Posted

In the catalog > includes > header.php file look for code similar to this (should be right after the <body> tag) -

 

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr class="header">

<td>

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'Your_Logo.gif', 'Your Shop Name') . '</a>'; ?></td>

<td> </td>

<td> </td>

</tr>

</table>

 

I can't remember now if a standard osC had two instances of <td> or three, you can add the 3rd as that might be what I have done. Yours might have more coding too as I striped some from mine, but anyway... The code that is in blue is what you can move to the center table cell <td> and add a center tag. So it will look like this -

 

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr class="header">

<td width="33%"> </td>

<td width="*" align="center"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'Your_Logo.gif', 'Your Shop Name') . '</a>'; ?></td>

<td width="33%"> </td>

</tr>

</table>

 

You might need to alter your <td> width settings.

 

Hope that helps! ;)

- :: Jim :: -

- My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -

Posted

I am trying to learn all of this also.

 

What I did was add "text-align:center" to the "tr.header" in the stylesheet.

 

Anybody see any long term problems doing it this way?

 

Thanks

 

Tom

Posted

Hey Tom,

 

Sure it is best to make as many changes or should I say settings in the stylesheet as possible. The only thing regarding your "text-align:center" is that it might not effect the image, only the text and in every table cell in that row. Also a better syntax to use would be align="center". But what if in the other table cells you didn't want the content centered? You might have or want something like this -

<tr>

<td align="left">Some sort of text left justified</td>

<td align="center">Company Logo</td>

<td align="right">Possibly a smaller image or banner</td>

</tr>

 

That's the only reason why I showed an example of the align="center" in the table cell. It would leave the others alone. I didn't want to mess anything up in those cells LOL.

 

:thumbsup:

- :: Jim :: -

- My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -

Posted

Your right. If I added more rows it would affect all of them.

 

It does work well with images though.

 

I was under the impression that "align=center" was going to be depreciated. I am trying to limit my use of tables just for practice.

 

edit: meant to say to make me learn css better

 

Thanks for the row catch

 

 

Tom

Posted

OK, I removed the text-align:center from "tr.header"

 

I created a td.headercenter {text-align:center}

 

This way it only affects the ones I want centered.

 

Thanks again. This way when I add more tr's or td's I won't have problems.

 

 

T

Posted

Cool Tom :thumbsup:

 

Yes you caught me... I'm an old dog trying to learn new tricks. :blush:

Old way - align="center" [classified as depreciated by the w3c]

New way - text-align: center

Let's not forget about floating...

I'm having issues remembering not to use the <img align="left" syntax especially on pages or sites that are already designed with the older code and tables. Oh well...

 

But thanks for waking me up Tom. I sure would hate to get caught with my pants down. (w00t)

 

LOL

- :: Jim :: -

- My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...