Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles

Reply
 
Thread Tools
[HOW TO - vB4] Two column forum/sub-forum setup via CSS only
Lynne's Avatar
Lynne
Join Date: Sep 2004
Posts: 41,180

 

California/Idaho
Show Printable Version Email this Page Subscription
Lynne Lynne is offline 11-20-2009, 10:00 PM

This is just a quick writeup of the very basics to achieve a two column setup for your forums through only the use of CSS - no template modifications or plugins required. (Original thread requesting this infomation is here.)

I am NOT going to be teaching CSS is this article! You WILL need to have some basic understanding of what Cascading Style Sheets are all about in order to further change this since this is only the basics to put stuff in position with no padding or margins or any other styling applied - that is up to you to do.

This was written during the beta3/beta4 testing and may need to be modified for use with other versions since classes may be changed as the style has not been finalized yet. This was written to work with the default style and default stylevars (default at this time, that is). If you have customized your style in any way, you may have to change this a bit to work with your style. These classes also only apply to the forum home page but can easily be modified (by you!) to work on the forumdisplay pages and to work only for certain categories.

Making the browser width small may change things, or if you have long descriptions or sub-forums listed or moderators listed, you may have to change the CSS to accommodate that. As I said, this in ONLY AN OUTLINE of what you need to do. You will have to add styling information yourself.

This is basically what you will end up with:


The very basics of what to do
Add this to the additional.css template - it must be added *after* any other definitions regarding these sub-forums have been declared - if you don't understand why that is, then please read up on exactly what Cascading Style Sheets are all about):

Code:
.forumhead + .childforum .L2:first-child .forumrow, .forumhead + .L2 .forumrow {
  border-top: 0;
}
.forumrow .table {
  height: 100px;
}
ol.childforum {
  float: left;
  width: 100%;
  margin: 0;
  padding: 0;
}
.childforum li.forumbit_post {
  float: left;
  width: 50%;
  margin: 0;
  padding: 0;
  clear:none;
}
#forums .L1 .L2 {
  clear:none;
}
.forumbit_post .forumrow .forumlastpost {
  clear:both;
  width:95%;
}
.forumbit_post .forumlastpost .lastpostby {
  display: block;
  float: left;
}
.forumbit_post .forumlastpost .lastpostdate {
  display: block;
  float: right;
}
.forumbit_post .forumlastpost .lastposttitle {
  display: block;
  float: left;
}
.forumbit_post .foruminfo {
  clear:right;
  float:left;
  min-width:50%;
  width:70%;
}
.forumbit_post .forumstats, .forumbit_post .forumstats_2 {
  width:20%;
}
This same concept can be applied to any list in the style. For instance, you can change the listing of sub-forums under the Sub-Forums listing on the main page also with just a couple of lines:

Code:
.subforums ol.subforumlist  {
  float: left;
  width: 100%;
  margin: 0;
  padding: 0;
}
.subforumlist li.subforum {
  float: left;
  width: 50%;
  margin: 0;
  padding: 0;
  clear:none;
}
/* to remove the commas */
.commalist li.subforum:after {
    content:"";
}
Those lines will get you this (this shows it with commas, add the code under the "to remove the commas" comment and you will not have commas):


Again, this article is NOT about teaching you CSS. You will have to style this yourself and also make any other changes necessarily because of customized styles or changes after beta 4.
Attached Images
File Type: png forum_css5.png (48.8 KB, 0 views)
File Type: png subforum_css1.png (43.9 KB, 0 views)
Reply With Quote
  #82  
Old 09-27-2010, 02:52 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by AliceHoward View Post
Hmmm, something is wrong with the snippet I posted above, every now and then one of the sub-forums gets moved over somehow so an empty space appears. You can see it occurring here: http://styleorigin.com/community/for...-Mental-Health

It's only every now and then, if I refresh the page a few times it seems to right itself, obviously there's something wrong or it wouldn't dropdown.
I can't see the glitch in firefox on my mac. What is happening? Usually the issue is a border width that is throwing it off, so you can change the width to be just slightly less (there were some examples earlier in the thread) and it will be fine.
Quote:
Originally Posted by Alfa1 View Post
Yes, I was just browsing your site, before I read your last post. I noticed that.

Does anyone know what's causing Alice's bug with sub-forums display?

What would the code be to display 3 columns? Same but 0%, 33% and 66% ?
Again, I think someone might have already posted it in here. But yeah, you wouldn't use 50%, but instead go for 33.3% or so.
Reply With Quote
  #83  
Old 09-27-2010, 04:24 PM
AliceHoward AliceHoward is offline
 
Join Date: Mar 2010
Location: Oxford, England
Posts: 188
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne, I found the problem and fixed it, this is why you are not seeing it any more, I was fixing tea for my children so haven't had time to get on until just now.

I fixed it by doing the following.

forumbits.css
FIND:
Code:
.forumbit_post .forumstats li, .forumbit_post .forumstats_2 li{
    font-size: {vb:stylevar mid_fontSize}{vb:stylevar font.units};
    text-align: {vb:stylevar right};
    padding-{vb:stylevar right}: {vb:math {vb:stylevar padding}*2};
    display:block;
}
IN-LINE FIND:
Code:
padding-{vb:stylevar right}: {vb:math {vb:stylevar padding}*2};
REPLACE WITH:
Code:
padding-{vb:stylevar right}: 5px;
Thank you again for this brilliant article, very helpful.
Reply With Quote
  #84  
Old 09-27-2010, 06:03 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by AliceHoward View Post
Hi Lynne, I found the problem and fixed it, this is why you are not seeing it any more, I was fixing tea for my children so haven't had time to get on until just now.
I'm glad you got it fixed and thanks for posting what you did. (I'd rep you if they had rep here. )
Reply With Quote
  #85  
Old 10-28-2010, 06:37 PM
slinky slinky is offline
 
Join Date: Dec 2001
Posts: 202
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lynne -

Thanks for the help in getting two subforums, side by side. Is there any easy way to get three to work? In my experience, that seems to be the optimal number you can use in order to condense all the vertical scrolling if you require a good number of forums and subforums. I used to have three but the subforum manager that did it now destroys validation and creates other problems when used. Having a third forum on a horizontal line would be indispensable - if you can help lead this old horse to water.

Bummer - I just saw what you wrote above, LOL!!!! I will try out the code now!

Confirmed... 33% works like a charm!
Reply With Quote
  #86  
Old 11-06-2010, 07:13 PM
everfresh2 everfresh2 is offline
 
Join Date: Nov 2010
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

in 4.0.8 i did the same.

it is showing correctly. but above the footer area is not OK due to this CSS edits.

Please someone guide me how to fix this ?

screen shot is attached.
Attached Images
File Type: png error.png (15.0 KB, 0 views)
Reply With Quote
  #87  
Old 11-06-2010, 08:15 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by everfresh2 View Post
in 4.0.8 i did the same.

it is showing correctly. but above the footer area is not OK due to this CSS edits.

Please someone guide me how to fix this ?

screen shot is attached.
That isn't from the CSS here. It's from something else (you didn't update your templates after upgrading). Remove the CSS I wrote in the first post from your style and you'll see you still have that issue.
Reply With Quote
  #88  
Old 11-18-2010, 01:23 PM
vinayak vinayak is offline
 
Join Date: Oct 2010
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi

Is there any way to add a sidebar on the threads page - showthread.php?

Also, can a 3-column layout be created for the forum home page? I need the page to look like this:



Thanks & Regards,
Vinayak
Reply With Quote
  #89  
Old 11-18-2010, 01:37 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by vinayak View Post
Hi

Is there any way to add a sidebar on the threads page - showthread.php?

Also, can a 3-column layout be created for the forum home page? I need the page to look like this:



Thanks & Regards,
Vinayak
Sure, but none of that has anything to do with what this thread is about.
Reply With Quote
  #90  
Old 11-18-2010, 01:43 PM
vinayak vinayak is offline
 
Join Date: Oct 2010
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am sorry. I thought that since this was about layout on the forum page, I put my query here.
Reply With Quote
  #91  
Old 12-02-2010, 03:28 AM
iBaker's Avatar
iBaker iBaker is offline
 
Join Date: Oct 2006
Location: Melbourne, Australia
Posts: 152
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne
Great edits to the css...thanks.

I have 3 questions:
1. How do I remove the text "Sub-forums"...is removing it from the template the only way?
2. Everyone says "it's ok, just add it to the "additional.css" template...do you know if this just builds up the final css making it bigger or is it always better to try and change the existing css templates?
3. Can you think of anyway that I can keep the "Threads/Posts" and "Last Post" but have the sub forums spread across the page...like this:?

Attachment 124074

Thanks!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:38 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07115 seconds
  • Memory Usage 2,345KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (13)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (3)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete