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.

slackin-jer 01-06-2010 09:39 PM

How did you integrate that shopping cart into your header?

tafreeh 01-07-2010 05:07 AM

nice mod... got quick question..
after editing those temp.. we would be able to select the logo and condition via admin cp riht?

Dr.osamA 01-07-2010 07:34 AM

try it
Thanxx

brb
________
Black Xxx

syrus.xl 01-08-2010 08:58 AM

Quote:

Originally Posted by tafreeh (Post 1949321)
nice mod... got quick question..
after editing those temp.. we would be able to select the logo and condition via admin cp riht?

It is coded to use the default logo and the default header ad position 2 which is the right side. So, everything will still function from the AdminCP.

bandare 01-08-2010 11:11 AM

Where did you get that bottom widget type thing that includes twitter/facebook etc?

syrus.xl 01-08-2010 09:32 PM

Quote:

Originally Posted by bandare (Post 1950303)
Where did you get that bottom widget type thing that includes twitter/facebook etc?

Hi bandare,

All the mods used on the site you can find out about at this url:
http://www.digitalport.co.uk/blogs/4...gital-port-21/

syrus.xl 01-08-2010 09:34 PM

Quote:

Originally Posted by forumtester (Post 1949070)
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.

I'll try and find out why this is happening, then again IE is a pain to code workarounds for, wish Microsoft would code their browsers to use world standard coding! :rolleyes:

forumtester 01-17-2010 09:43 AM

Not working with 4.0.1

syrus.xl 01-17-2010 09:52 AM

Strange, I'm using 4.0.1 and it's still working fine...

forumtester 01-17-2010 10:22 AM

It worked beautifully in 4.0.0, but I reverted all templates before the upgrade to 4.0.1 and now it won't work.

Some of the coding to change and replace has been modified in 4.0.1.

I reverted all mods for the 4.0.1 upgrade, just coming back to reinstall this mod and it won't have it.

ErnestA 01-22-2010 08:54 PM

Sorry for the stupid question, but where do you find "ad area 2" to place a picture in?

syrus.xl 01-22-2010 09:05 PM

Quote:

Originally Posted by ErnestA (Post 1963781)
Sorry for the stupid question, but where do you find "ad area 2" to place a picture in?

You need to setup the banner ad in the Advertising Manager within your vBulletin AdminCP.

ErnestA 01-22-2010 11:38 PM

Hmm... I've got vB 3.8.4 and a test server setup with 4.0.1. I see nothing in admincp called advertising in my 4.0.1 admincp, but I do have an advertising tab in 3.8.4 (but it only contains google adsense).

Is it supposed to be located in the same place in 4.0.1? If so, I'll have to post a message at vbulletin.com to see what happened to my install and why that tab is missing.

Thanks,

syrus.xl 01-23-2010 11:30 AM

1 Attachment(s)
Quote:

Originally Posted by ErnestA (Post 1963912)
Hmm... I've got vB 3.8.4 and a test server setup with 4.0.1. I see nothing in admincp called advertising in my 4.0.1 admincp, but I do have an advertising tab in 3.8.4 (but it only contains google adsense).

Is it supposed to be located in the same place in 4.0.1? If so, I'll have to post a message at vbulletin.com to see what happened to my install and why that tab is missing.

Thanks,

It is actually called 'Advertising' in the AdminCP panel. I have taken a screenshot and highlighted the exact section where it is located.

It is standard on all versions of the vBulletin 4.0 series.

ErnestA 01-23-2010 06:05 PM

Yeah, thanks for the info.... Something must have gone sideways in my upgrade from 3.8.4 PL2 to 4.0.1 as that panel is just not there. It's still present in 3.8.4 (only contains Google Adsense).
Luckily I'm doing all my testing on a test server for 4.0.

I did another fresh install on my test server (no upgrade, just a fresh install of vBulltetin) and the tab is there now. I've posted a message on vBulletin.com to see if they can help me figure out how to get the advertising tab back on the upgraded 4.0.1 install.

Thanks for your help

syrus.xl 01-23-2010 06:28 PM

Ah right...

I actually cloned my site on the server, before even attempting the upgrade to 4.0 from 3.8.4. Placed the 'clone' in a new directory, and imported the database in to a new one. I only done it on the server because it is much quicker than downloading the whole lot, which would have taken hours!!!! I just used the SSH command line prompt, so it only took about 5 minutes.

I ran in to a few errors, but nothing that I could not easily fix. :)

Anyway, glad you got there in the end! :)

ErnestA 01-23-2010 07:39 PM

So you didn't go through a regular upgrade, you did a fresh install of 4.0 and then used ImpEx to import the original database? Or you just made a copy of your site and ran the upgrade process on the copy?

syrus.xl 01-23-2010 07:47 PM

I made a duplicate of my entire vBulletin 3.8.4 - First the file system then created a new database and made a full SQL dump from my original database in to a new database. I don't use Impex, it seems to give varying results.

All I had to change was my cloned config.php file, so it pointed to the 'cloned' database and not the 'live' one.

From there, I upgraded to vBulletin 4.0 - with 3 failed attempts, but because it was just data that had been changed, I just re-dumped the SQL back in each time. Probably, the easiest and quickest way of doing an upgrade without breaking your 'live' site.

Sax on the Web 02-04-2010 10:32 PM

Mod installed, thank you.

renders well on http://forum.saxontheweb.net/forum.php

However, does not show on http://forum.saxontheweb.net/content.php

My previous header worked the same on both?

thanks in advance,

syrus.xl 02-05-2010 07:03 AM

Quote:

Originally Posted by Sax on the Web (Post 1975028)
Mod installed, thank you.

renders well on http://forum.saxontheweb.net/forum.php

However, does not show on http://forum.saxontheweb.net/content.php

My previous header worked the same on both?

thanks in advance,

Hi,

You will need to edit your front page, and where it says Style select Inherit - this will then inherit the correct style site-wide.

HTH

Sax on the Web 02-05-2010 09:54 AM

Quote:

Originally Posted by syrus.xl (Post 1975221)
Hi,

You will need to edit your front page, and where it says Style select Inherit - this will then inherit the correct style site-wide.

HTH

Thanks a lot,
in the matter of fact I changed it to "vb4 default" and that did the trick. (It was set as "vB3 incompatible" before).

Follow-up question: I would like to create a separate style for the front page which would be a sub-set of the forum header. (I.e. only one out of four banners.) How to get started?

thnx in advance,

HRCHOSTING 02-07-2010 05:36 PM

Installed but its pushing the image half way off the side of my page. Any idea's?

RedTrinity 02-12-2010 02:48 AM

Quote:

Originally Posted by HRCHOSTING (Post 1976805)
Installed but its pushing the image half way off the side of my page. Any idea's?

Happening on our forum too :confused: VB4.0.1, using Firefox 3.5.

syrus.xl 02-12-2010 06:14 AM

I coded this for version 4.0.0 - it does require updating, but this will not be done until vBulletin release 4.0.2, just in case they make further CSS changes to the header template.

Sorry about this...

murekhalir 02-12-2010 05:08 PM

its all good. I'll just have to wait then.

It is chrome compatible for sure.

ie7 no.

ie 8 yes.

daveaite 02-13-2010 08:01 AM

Quote:

Originally Posted by HRCHOSTING (Post 1976805)
Installed but its pushing the image half way off the side of my page. Any idea's?

Adjust vbulletin.css

Edit this to perfection. :) Heres what I did below...

Code:

#logo_main {
    float:left;
    display:inline-block;
    width:274px;
    height:60px;
    margin-top:25px;
    margin-left:0px;
    position:relative;

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


RedTrinity 02-13-2010 10:31 AM

1 Attachment(s)
Quote:

Originally Posted by daveaite (Post 1981242)
Adjust vbulletin.css

Edit this to perfection. :) Heres what I did below...

Thanks. Your advice helped me to get my banner back from wandering off the right side of the screen! Though still having issues with getting it to the right of the existing banner. Here's where I am at the moment (see attached image):

PHP Code:

#logo_main {
    
float:left;
    
display:inline-block;
    
width:400px;
    
height:100px;
    
margin-top:5px;
    
margin-left:0px;
    
position:relative;
}  
#banner_ad_top {
     
float:right;
     
display:inline-block;
     
margin-right:250px;
     
margin-top:0px;
     
width:400px;
     
height:100px


Any suggestions? I'm not sure how I can get the ad banner any further up whilst the margin-top is already set to 0 :confused: It seems to be aligning itself with 'the top' being distinguished as the bottom of the left banner, instead of the top of the header area.

Not sure how to fix this. Would appreciate further help.

Cheers :)

ETA: Just to add, apon further experimenting, raising that margin-right: amount with the ad banner does indeed fix the banner off the screen issue, but it also creates the big gap underneath the original logo banner (to which the ad banner is on the right of, as per the pic attached).

So whilst fixing the old problem, it seems to create a new one.

RedTrinity 02-13-2010 11:01 PM

1 Attachment(s)
Ok so I managed to get the banners aligned in FF (my default browser) and looking good. But they are still coming up as misaligned for IE :confused:

Have tried adjusting the doc_minwidth value, but doesn't seem to be making much (if any) difference with this problem.

Starting to do my head in a bit :(

HRCHOSTING 02-14-2010 03:17 AM

Quote:

Originally Posted by daveaite (Post 1981242)
Adjust vbulletin.css

Edit this to perfection. :) Heres what I did below...

Code:

#logo_main {
    float:left;
    display:inline-block;
    width:274px;
    height:60px;
    margin-top:25px;
    margin-left:0px;
    position:relative;

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


worked like a charm, thanks

RedTrinity 02-14-2010 03:24 AM

Quote:

Originally Posted by HRCHOSTING (Post 1981842)
worked like a charm, thanks

Just make sure its working properly in all browsers, as I found this fixed my problem in Firefox, but not IE.


All times are GMT. The time now is 06:06 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.01381 seconds
  • Memory Usage 1,850KB
  • 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
  • (7)bbcode_code_printable
  • (1)bbcode_php_printable
  • (16)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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