Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: TroyG on September 04, 2008, 02:58:01 PM

Title: Centering Header
Post by: TroyG on September 04, 2008, 02:58:01 PM
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

Title: Re: Centering Header
Post by: kat on September 04, 2008, 03:11:14 PM
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.
Title: Re: Centering Header
Post by: TroyG on September 04, 2008, 03:13:13 PM
Is that in the index.template.php and about what line ?
Thanks for the help
Title: Re: Centering Header
Post by: kat on September 04, 2008, 03:15:35 PM
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.
Title: Re: Centering Header
Post by: TroyG on September 04, 2008, 03:24:44 PM
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.
Title: Re: Centering Header
Post by: TroyG on September 04, 2008, 03:25:40 PM
We only run the default template.
Title: Re: Centering Header
Post by: kat on September 04, 2008, 03:28:50 PM
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.
Title: Re: Centering Header
Post by: TroyG on September 04, 2008, 03:45:11 PM
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....
Title: Re: Centering Header
Post by: kat on September 04, 2008, 03:48:04 PM
</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.
Title: Re: Centering Header
Post by: TroyG on September 04, 2008, 03:56:07 PM
Tried that and it still did not work. It said there was an error in line111
Title: Re: Centering Header
Post by: kat on September 04, 2008, 03:57:47 PM
Gimme a clue, here. "An error" doesn't tell me much.

Did you put the graphic in the root of public_html?
Title: Re: Centering Header
Post by: ccbtimewiz on September 04, 2008, 03:58:26 PM
</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.
Title: Re: Centering Header
Post by: kat on September 04, 2008, 04:01:38 PM
<center><img src="FULL PATH TO YOUR IMAGE"></center>

If it's in the root of public_html, you just need the filename.
Title: Re: Centering Header
Post by: TroyG on September 04, 2008, 04:03:00 PM
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">';
Title: Re: Centering Header
Post by: kat on September 04, 2008, 04:06:09 PM
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.
Title: Re: Centering Header
Post by: TroyG on September 04, 2008, 04:20:55 PM
I sent you a PM
Title: Re: Centering Header
Post by: kat on September 04, 2008, 04:25:43 PM
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.
Title: Re: Centering Header
Post by: kat on September 04, 2008, 04:38:54 PM
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.
Title: Re: Centering Header
Post by: ccbtimewiz on September 04, 2008, 04:44:37 PM
<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>';
Title: Re: Centering Header
Post by: kat on September 04, 2008, 04:48:32 PM
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.

Title: Re: Centering Header
Post by: TroyG on September 04, 2008, 04:51:20 PM
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
Title: Re: Centering Header
Post by: ccbtimewiz on September 04, 2008, 05:06:24 PM
Link to site? I don't see this code on your site.
Title: Re: Centering Header
Post by: kat on September 04, 2008, 05:07:08 PM
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.
Title: Re: Centering Header
Post by: TroyG on September 04, 2008, 05:32:59 PM
http://ultimateaircooled.com/simplemachinesforum/index.php

Title: Re: Centering Header
Post by: ccbtimewiz on September 04, 2008, 05:44:36 PM
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.
Title: Re: Centering Header
Post by: TroyG on September 04, 2008, 05:49:14 PM
Yes sir , all I want is this centered on the header.....

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.ultimateaircooled.com%2Fimagefolder%2Fnewforumheader.jpg&hash=45b0575f053b4553c74d9e705133c4d9e1da9c4c)
Title: Re: Centering Header
Post by: ccbtimewiz on September 04, 2008, 06:17:19 PM
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>';
Title: Re: Centering Header
Post by: kat on September 04, 2008, 06:21:40 PM
Therein lies the pronlem. No ftp access, at the moment.
Title: Re: Centering Header
Post by: TroyG on September 04, 2008, 06:45:13 PM
So I do have to go in through the ftp or can I go in through ADMIN ?
Title: Re: Centering Header
Post by: ccbtimewiz on September 04, 2008, 06:59:00 PM
For edits to the default theme, it is required to go through FTP.

How do I use FTP? / What is FTP? (http://docs.simplemachines.org/index.php?topic=480)
Title: Re: Centering Header
Post by: hayley2007 on September 04, 2008, 10:00:52 PM
Thank you ccbtimewiz it works for me, ive been looking how to do this for ages. You really have made my day. *virtual hug*