vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Forum Home Enhancements - Align Logo with Header Advert 2 (No Drop) (https://vborg.vbsupport.ru/showthread.php?t=232325)

syrus.xl 01-05-2010 10:00 PM

Align Logo with Header Advert 2 (No Drop)
 
1 Attachment(s)
I originally coded this for my vBulletin 4.0, but so many people have been asking on vBulletin.com how to do this - so I thought I would release it on here, as well.

What it does:

By default if you add any advertisement to the header, you will find that your header logo is 'pushed' upwards. Many people prefer that logo is aligned with the advert and not placed above. ** See attached screenshot **

DEMO:
http://www.digitalport.co.uk
I have coded this little modification so that if you place an advert in ad area 2 of the header it will appear next to your logo, and will not affect your logo's position whatsoever. It is coded to accept a standard banner size of 468x60 in the header ad 2 section. You can adjust this to suit other banner sizes as required.

In the #logo_main adjust the width and height values to suit your own logo. The margin-top value adjusts the distance between the top of your logo and the top of the toplinks. margin-left I have set to 20px, but you can adjust this to suit where you want the logo to be from the left side.

The best way is to adjust the values gradually if you are not sure about CSS coding.

Installation:

In the vbulletin.css template find:
Code:

.body_wrapper {
    padding: 0 {vb:math 2 * {vb:stylevar padding}} {vb:math {vb:stylevar padding}*2};
    background: {vb:stylevar body_background};
    -moz-border-radius: {vb:stylevar border_radius};
    -webkit-border-radius: {vb:stylevar border_radius};
    _display: inline;
}

Add after:
Code:

/* Replacement Header CSS */

#header_wrapper {
    width:100%;
    height:140px;
}
#logo_main {
    float:left;
    display:inline-block;
    width:274px;
    height:98px;
    margin-top:20px;
    margin-left:20px;
    position:relative;

#banner_ad_top {
    float:right;
    display:inline-block;
    margin-right:20px;
    margin-top:50px;
    width:468px;
    height:60px;
}


In the header template find and remove:

Code:

{vb:raw ad_location.global_header2}

In the header template find and remove:

Code:

    <div><a name="top" href="{vb:raw vboptions.forumhome}.php{vb:raw session.sessionurl_q}" class="logo-image"><img src="{vb:stylevar titleimage}" alt="Powered by vBulletin" /></a></div>

Replace with this code:

Code:

<!-- Start Custom Header -->
<div id="header_wrapper">
    <div id="logo_main">
    <a name="top" href="{vb:raw vboptions.site_tab_url}{vb:raw session.sessionurl_q}" class="logo-image"><img src="{vb:stylevar titleimage}" alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" /></a>
    </div>
    <div id="banner_ad_top">
    {vb:raw ad_location.global_header2}
    </div>
</div>
<!-- End Custom Header -->


Important:

One additional StyleVar you will need to change is the doc_minWidth to around 800px or more depending on your layout width. This will stop the advert div from dropping below your logo in the header, if someone is using a low resolution to view your website.

forumtester 01-06-2010 10:24 AM

Where do you find the
#logo_main

forumtester 01-06-2010 10:26 AM

Sorry, stupid question

Alecsmith 01-06-2010 10:36 AM

Header banner is not align it moved to right hand site.

syrus.xl 01-06-2010 11:07 AM

Quote:

Originally Posted by Alecsmith (Post 1948628)
Header banner is not align it moved to right hand site.

The ad banner should be right aligned, it is set by the CSS float:right parameter. It should have a 20px margin as well, which can be changed to suit your forum/cms header.

forumtester 01-06-2010 11:07 AM

Brilliant Mod.

Just one thing. The mod makes the header taller. I have tried changing the header wrapper height value from 140 to 80, but the header stays at around 100. Any idea's?

Also it doesn't work in the CMS

Found the 100 value (98) it was the logo value.

syrus.xl 01-06-2010 11:49 AM

Quote:

Originally Posted by forumtester (Post 1948646)
Brilliant Mod.

Just one thing. The mod makes the header taller. I have tried changing the header wrapper height value from 140 to 80, but the header stays at around 100. Any idea's?

The height is dependent on a few parameters set in the CSS.

#banner_ad_top has a margin-top of 50px - You can reduce this as required.
The same applies to the
#logo_main which has a margin-top of 20px - again adjust as necessary.

Quote:

Also it doesn't work in the CMS
This will work in the CMS, but because of a current bug in vB4.0 Gold it will only work if this modification is done on the default template. Hopefully, when the next release is ready, this will be fixed.

forumtester 01-06-2010 11:59 AM

Found my height issue, it was this variable

#logo_main {
float:left;
display:inline-block;
width:274px;
height:98px;
margin-top:20px;
margin-left:20px;
position:relative;

Still can't get it to work in the CMS and the mod is done on the default style.

forumtester 01-06-2010 07:50 PM

Sorted it.
You have to hover over the section title in the CMS, then click the pencil icon.
Then set the "Style" to Inherit.

Superb Mod

forumtester 01-06-2010 08:35 PM

Quote:

Header banner is not align it moved to right hand site.
I think I know what he means.
In IE7, the banner slides off the edge of the forum on the rhs. It site halfway on and halfway off the forum.

It doesn't do it in IE8.


All times are GMT. The time now is 11:24 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01116 seconds
  • Memory Usage 1,749KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete