News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Centering Header

Started by TroyG, September 04, 2008, 02:58:01 PM

Previous topic - Next topic

TroyG

I am trying to center my jpg in my header and can not find were in the code to change it from a LEFT to a CENTER. Any help Please.

http://ultimateaircooled.com/simplemachinesforum/index.php


kat

Looks a bit too wide, to me.

Anyway, try <center><img src="Banner.jpg" usemap="#Banner" alt="" style="border-style:none" /></center>

Anyway, try <center><img src="Banner.jpg"></center> might even do it.

TroyG

Is that in the index.template.php and about what line ?
Thanks for the help

kat

I put mine just below

</head>
<body>';


I didn't put it in the index.template, though. Because I have quite a few themes, I made a seperate file named "banner.php" and called it from each theme's template. That way, if I alter it, I only have to modify one file, instead of loads.

TroyG

I just went into the admin, logo, image, url and tried it there and it did not work either. I was thinking there was a place in the index.template.php that I could just change it from left to center.

TroyG

We only run the default template.

kat

Try the code I put, modifying it to the path and name of your banner, just after the

</head>
<body>';

bit of the index.template.

and before the echo '
<div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' style="width: 100%;"' : '', '>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="catbg" height="32">';



bit.

It certainly works, for me.

Keep a copy of the original file, so you can replace it, should things go wrong.

TroyG

This is what mine shows

</head>
<body>';

   // The logo, user information, news, and menu.
   echo '
   <table cellspacing="0" cellpadding="0" border="0" align="center" width="95%" class="tborder">
      <tr style="background-color: #ffffff;">
         <td valign="middle" align="left"><img src="', !empty($settings['header_logo_url']) ? $settings['header_logo_url'] : $settings['images_url'] . '/smflogo.gif', '" alt="" /></td>
         <td valign="middle">';

   // If the user is logged in, display stuff like their name, new messages, etc.


Still not sure were to put it....

kat

</head>
<body>';

JUST HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

   // The logo, user information, news, and menu.
   echo '
   <table cellspacing="0" cellpadding="0" border="0" align="center" width="95%" class="tborder">
      <tr style="background-color: #ffffff;">
         <td valign="middle" align="left"><img src="', !empty($settings['header_logo_url']) ? $settings['header_logo_url'] : $settings['images_url'] . '/smflogo.gif', '" alt="" /></td>
         <td valign="middle">';

   // If the user is logged in, display stuff like their name, new messages, etc.

TroyG

Tried that and it still did not work. It said there was an error in line111

kat

Gimme a clue, here. "An error" doesn't tell me much.

Did you put the graphic in the root of public_html?

ccbtimewiz

</head>
<body>';

echo 'the html code';

   // The logo, user information, news, and menu.
   echo '
   <table cellspacing="0" cellpadding="0" border="0" align="center" width="95%" class="tborder">
      <tr style="background-color: #ffffff;">
         <td valign="middle" align="left"><img src="', !empty($settings['header_logo_url']) ? $settings['header_logo_url'] : $settings['images_url'] . '/smflogo.gif', '" alt="" /></td>
         <td valign="middle">';

   // If the user is logged in, display stuff like their name, new messages, etc.

kat

<center><img src="FULL PATH TO YOUR IMAGE"></center>

If it's in the root of public_html, you just need the filename.

TroyG

This how I put it

</head>
<body>';

<center><img src="Banner.jpg" usemap="#Banner" alt="" style="border-style:none" /></center>

   // The logo, user information, news, and menu.
   echo '
   <table cellspacing="0" cellpadding="0" border="0" align="center" width="95%" class="tborder">
      <tr style="background-color: #ffffff;">
         <td valign="middle" align="left"><img src="', !empty($settings['header_logo_url']) ? $settings['header_logo_url'] : $settings['images_url'] . '/smflogo.gif', '" alt="" /></td>
         <td valign="middle">';


And

</head>
<body>';

<center><img src="http://www.ultimateaircooled.com/imagefolder/newforumheader.jpg" usemap="#Banner" alt="" style="border-style:none" /></center>

   // The logo, user information, news, and menu.
   echo '
   <table cellspacing="0" cellpadding="0" border="0" align="center" width="95%" class="tborder">
      <tr style="background-color: #ffffff;">
         <td valign="middle" align="left"><img src="', !empty($settings['header_logo_url']) ? $settings['header_logo_url'] : $settings['images_url'] . '/smflogo.gif', '" alt="" /></td>
         <td valign="middle">';

kat

#14
Your graphic isn't named newforumheader.jpg, in that first one.

Want to give me your ftp details, via PM, so I can have a go?

Looking at it, you might want to shrink the banner. If you get it centred, the page might look weird.

TroyG


kat

Looking at it, you might find that, if you make the image the same width as the forum, it'll centre itself.

Without ftp access, it's gonna be tricky.

kat

Neh. I resized it and you get that annoying blue bit, on the right-hand side.

It'll have to be via ftp, I'm afraid.

ccbtimewiz

<body>';

<center><img src="Banner.jpg" usemap="#Banner" alt="" style="border-style:none" /></center>

Should be:

<body>';

echo '<center><img src="Banner.jpg" usemap="#Banner" alt="" style="border-style:none" /></center>';

kat

Well, the way I had it works on mine. Odd, huh?

He's not got ftp access, at the moment, though. When he has, he's gonna give me a shout and I'll see what I can do.

Ta, mate.


TroyG

I tried

</head>
<body>';

echo '<center><img src="http://www.ultimateaircooled.com/imagefolder/newforumheader.jpg" usemap="#Banner" alt="" style="border-style:none" /></center>';

   // The logo, user information, news, and menu.
   echo '
   <table cellspacing="0" cellpadding="0" border="0" align="center" width="95%" class="tborder">
      <tr style="background-color: #ffffff;">
         <td valign="middle" align="left"><img src="', !empty($settings['header_logo_url']) ? $settings['header_logo_url'] : $settings['images_url'] . '/smflogo.gif', '" alt="" /></td>
         <td valign="middle">';


It stills is to the left

ccbtimewiz

Link to site? I don't see this code on your site.

kat

Yeah, sorry. The usemap bit's superfluous. You don't need that.

<center><img src="http://www.ultimateaircooled.com/imagefolder/newforumheader.jpg"></center>';

should be enough.


ccbtimewiz

Are you talking about your logo? If that's true, you need to fix the rowspan. I don't see any other image code in the header.

TroyG

Yes sir , all I want is this centered on the header.....


ccbtimewiz

Oh I see now. What Kat was pointing out was something you didn't need to edit at all.

Open index.template.php

Find:
echo '
<div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' style="width: 100%;"' : '', '>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="catbg" height="32">';

if (empty($settings['header_logo_url']))
echo '
<span style="font-family: Verdana, sans-serif; font-size: 140%; ">', $context['forum_name'], '</span>';
else
echo '
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';

echo '
</td>
<td align="right" class="catbg">
<img src="', $settings['images_url'], '/smflogo.gif" style="margin: 2px;" alt="" />
</td>
</tr>
</table>';


Replace with:
echo '
<div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' style="width: 100%;"' : '', '>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2" align="center" class="catbg" height="32">';

if (empty($settings['header_logo_url']))
echo '
<span style="font-family: Verdana, sans-serif; font-size: 140%; ">', $context['forum_name'], '</span>';
else
echo '
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';

echo '
</td>
</tr>
</table>';

kat

Therein lies the pronlem. No ftp access, at the moment.

TroyG

So I do have to go in through the ftp or can I go in through ADMIN ?

ccbtimewiz

For edits to the default theme, it is required to go through FTP.

How do I use FTP? / What is FTP?

hayley2007

Thank you ccbtimewiz it works for me, ive been looking how to do this for ages. You really have made my day. *virtual hug*

Advertisement: