PDA

View Full Version : "body" tag placement...



speedway
Wed 25th Jan '06, 2:05am
I am in the process of converting a Joomla template to VB (actually, I am wrapping the template around the forum) and can see alot of work ahead. The new template in question has 3 class definitions for the body tag that define what the site will look like. But....for some reason the body tage is spread throughout quite a number of templates in VB. Would there be any compelling reason not to move the body tag into the head_include template, where any changes only have to be made in one place? I am just looking for an easier way of styling the body tag...

Actually, on this point, I would like to see any future templates have an outer template that controls the site basics and other templates for things like forum home, forum display etc to supply the content.

Anyway, of someone could answer my body tag question, it would be appreciated..

Cheers
Bruce

Zachery
Wed 25th Jan '06, 5:20am
Don't, why are you editing the body tag?

The body tag is defined in every main template

like

FORUMHOME
SHOWTHREAD
etc

They can have specific code per page, what do you need to define in the body tag that you cannot do in css or the area inside of <head> </head> ?

speedway
Wed 25th Jan '06, 5:46am
The template I am trying to apply has 32 possible configurations that can be applied just by assigning different classes to the body tag, for example < body class="page_bg width-1 align-1" >. Inside the css file is different definitions of the combination of tags, again for example body.width-1, body.width-2, body.width-3 etc. With the body tag in one place, this would be simple, however with it spread all over different templates, it makes it difficult. Yes, I could do this with CSS alone but why should I have to edit a number of definitions when a simple change to the classname in the body tag would suffice.

Seriously though, is the VB team has the forethought to split out different parts of the page as individual templates, I would have thought a "master" template would have been thought of. Oh, and BTW, I am not a newbie at VB, my site has been VB since Dec 2001.

As for styling different pages, can you point me to somewhere that actually does that. I would like to see what they do to each page that makes it different...

Cheers
BRuce

Zachery
Wed 25th Jan '06, 5:54am
Why can't you already do that with the body css tag in the style manager?

speedway
Wed 25th Jan '06, 6:04am
Why can't you already do that with the body css tag in the style manager?
Yes, I can. But I would rather change one tag than change 20 each time I wanted to test something different, I would rather have the 32 sets of class definitions all in one CSS file so I didn't have to retype all the different ones, again set the body tag to a different class, and bingo! everything changes. Isn' that the basic premise of CSS in the first place, change in one place, affect the overall?

Zachery
Wed 25th Jan '06, 6:18am
Yes, but I think we are missing each other here?

vBulletin 3/3.5 has a CSS manager, that is capable of storing CSS either inline or as files.

You can already make changes/ definitions to the body class in one place.

What does this already not do, that you are wanting to, so I can point you in the right direction?>

speedway
Wed 25th Jan '06, 7:40am
Yes, but I think we are missing each other here?

vBulletin 3/3.5 has a CSS manager, that is capable of storing CSS either inline or as files.

You can already make changes/ definitions to the body class in one place.

What does this already not do, that you are wanting to, so I can point you in the right direction?> Alrighty, I think I need to explain a little more. This particular template has options that allow it to be displayed in 4 different ways (up to 32 different combinations), just by setting different options in the body tag. Here are the body definitions from the css file:

First the body tag, generically set for all possibilites:



body {
margin: 0px 0px 0px 0px;
height: 100%;
font-size: 11px;
}

Nww, if I want the site to be fixed width I would do this:



<body class="page_bg thin">

with the "thin" CSS definitions being:


body.thin #nav a {
padding: 0em 0.5em 0.2em 1.1em;
}

body.thin div#wrapper {
width: 773px;
}

body.thin div#searchbox_mods {
width: 150px;
}

body.thin div#newsflash_mods {
right: 150px;
width: 150px;
}

body.thin td.inset_mods {
width: 150px;
}

body.thin table.nospace td.topleft_mods {
width: 150px;
}

body.thin table.nospace td.right_mods {
width: 150px;
}

How about I want fixed AND centered? I do this....



<body class="page_bg thin center">

which uses:



body.center div#wrapper {
margin: 0 auto;
}

Hmmm, I changed my mind: I now want to have it a variable width - minimum 750px, maximum 950px? I just change the body tag to:



<body class="page_bg vmax center">

which is supported by:



body.vmax #nav a {
padding: 0em 1.5em 0.2em;
}

body.vmax div#wrapper {
min-width: 750px;
max-width: 950px;
width: expression(document.body.clientWidth > 950? "950px": "auto" );
}

body.vmax div#searchbox_mods {
width: 15%;
}

body.vmax div#newsflash_mods {
right: 15%;
width: 20%;
}

body.vmax td.inset_mods {
width:25%;
}

body.vmax table.nospace td.topleft_mods {
width: 25%;
}

body.vmax table.nospace td.right_mods {
width: 20%;
}


and bingo! I have a site that respects min/max and is centered.

A number of other combinations is also possible....

So you see where I am coming from. Changing one setting on the body tag sets alot of things. By having to change each definition in the CSS file each time, I am actually wasting time. Changing the body tag however - in one place - offers me flexibility, which as I have said, is the essence of CSS itself....

EDIT: I would be very open to suggestions on how to accomplish this without touching the body tag, yet still retaining the simplicity of changing one varibale in one place...

Cheers
Bruce