SMF Support > SMF 1.1.x Support

Centering the header

(1/1)

Jane77:
In my SMF 1.1.15, in index.template.php (in a custom theme) I have:


<body>';

   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>
            
         </tr>
      </table>';

and... I tried inserting:

<div style = "text-align: center;"> <img src="(usual forum url)/community/header.jpg" usemap="#header" alt="" style="border-style:none" /></div>

immediately after the <body> and before the ';

and this resulted in the header being duplicated and centred above the original header.

Does anyone have any suggestions? 

 :-[

Antechinus:
Yup. For a start, it's standard web practice to link your logo to the home page. You also don't need all of that crappy old code, which is a relic from IE3 days. Try the following:


--- Code: ---<body>';

   echo '
   <div class="tborder">
      <h1 class="catbg">
               <a href="whatever_your_home_page_is" style="margin: 0 auto;" title="whatever_your_forum_name_is"><img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" /></a>
         </h1>
      </div>';
--- End code ---

Or, if you want extra css coolness and less bandwidth usage:


--- Code: ---<body>';

   echo '
   <div class="tborder">
      <h1 class="catbg">
               <a href="whatever_your_home_page_is" style="margin: 0 auto;" title="whatever_your_forum_name_is"></a>
         </h1>
      </div>';
--- End code ---

And in the css file add:


--- Code: ---h1 a {
    display: block;
    height: your_logo_height px;
    background: url (images/logo_name_here) center center no-repeat;
}
--- End code ---

That's assuming the logo is uploaded to your theme's images folder.

Navigation

[0] Message Index

Go to full version