If you are seeing this message, it is possible the page did not load properly. Please hit reload/refresh on your browser.
If you still see this message, you probably do not have a browser that supports web standards, although its content is accessible to any browser or Internet device.

Cool Tips & Tricks Cool Tips & Tricks

Help Communities:
Help Forums Bug Base
<< Prev Topic | Next Topic >>
Cool Tips & Tricks ::: CSS FAQ ::: Specific CSS assigned to forums
New Topic    Add Reply
Topic: Specific CSS assigned to forums  (?)  Click to receive email notification of replies Click to stop receiving email notification of replies email this topic to a friend
Tab1s Wynter

Registered User
ezSupporter
Posts: 39
Posted: 4/24/02 7:49 am    
Specific CSS assigned to forums
How to make CSS specific to forums, and not the whole board.

Edited by: atlass at: 5/17/02 4:01:10 am

  reply to this message

kanwulf 001

Registered User
ezSupporter
Posts: 813
Posted: 4/28/02 12:37 am    
Re: Specific CSS assigned to forums
Here's what I came up with. I have spent a couple hours testing it on three different boards. I have it working on both the old and new naming conventions ezboard has used. I'm sure it is not without fault so let me know what you find if you use it.



///////////////////////////////////////////////////////////////////////////////

// Programming: ~kanwulf~, kanwulf@jeeptalk.org

// Functions are free for private use.

//

// This ***** use Java***** 1.2 to write a different style sheet to each

// forum of an ©ezboard.

// In order for it to work you need to follow a simple naming convention for

// your .css files.

// The .css file for each forum should be named after the forum. If the forum

// name is fmyboardfrm8 the style sheet for it should be fmyboardfrm8.css

// If it's for your main page you use the boards name like so: bmyboard.css

// Enter the name of your board and the directory of your css file below and

// enjoy the versatility this ***** provides.

//

// In keeping with my "keep it short and simple" theme the ***** will call a

// unique .css file for every forum. If you wish to use the same file for more

// then one forum simply make copies of it and name it after each and every

// forum you wish.

///////////////////////////////////////////////////////////////////////////////


If your board is still hosted on one of the old 'pub' servers, change the red p to pub

   
<script language="JavaScript">
// Enter your boards id without the preceding "b" 
// ex: if the id is bmyboard use myboard
var board_name = 'myboard';

// Enter the full path to the directory where your .css files are located
var css_base = 'http://www.yourwebsite.com/forum/css/';

// Don't modify code below unless you understand the JavaScript used.
var reg_ex = new RegExp("^(http:\\/\\/p\\d+\\.ezboard.com\\/)([bf]" + board_name + "((frm\\d+)|[^.?]+)?)([.?]|$)", "i"); // assemble RegExp
var page_url = new String(self.location); // grab URL as a string
reg_ex.test(page_url);
var css = RegExp.$2 + ".css";
var style_sheet = '<link rel="stylesheet" href="' + css_base + css + '">';

document.write(style_sheet); 
</script>

Edited by: Nutrocker at: 6/29/04 2:00 pm

  reply to this message

Nutrocker

ezboard Moderator
ezSupporter
Posts: 5385
Posted: 10/26/02 3:07 pm    
Re: Specific CSS assigned to forums
As an addition to the above, some users have been experiencing problems in understanding the above script and procedures.

I shall try my best to help. I hope I get this right, I am no scripter!

In short the script uses a unique CSS file for each forum, each CSS file HAS to be named the same name as the forum ID, same rule applies for the main board CSS file. The script also needs to know where, on the internet, the CSS files can be found. So if you upload the files to http://www.myserver.com/files/ then that is the url you should use to enable the script to know where the files are found.

Firstly, to use the script and the CSS files, you will need some web space to upload the forum CSS files to. Once that has been done you will then know where the CSS files are, in other words you will know the url to where the CSS files are located on the internet.

An important part of this, is to make sure the CSS files are saved using the same forum name for each file.
fmyforum1.css
fmyforum2.css
and so on..

If you want a CSS file for the main board, make sure the CSS file is also saved with the same name of your main board ID.
e.g. bmyboard.css

Secondly, you enter the url path where the CSS files can be found by using this section in the script. Note that you use the / at the end of the url, this is because you are directing the script to look in a folder or directory.

    // Enter the full path to the directory where your .css files are located
var css_base = 'http://myserver.com/forum/css/';


again, within the script, the first section is where you would enter your board ID.

    
// Enter your boards id without the preceding "b" 
// ex: if the id is bmyboard use myboard
var board_name = 'myboard';


And lastly, the script would or should be placed in the advanced area (Custom HTML) in the 1st text box from the top.


    
// Enter your boards id without the preceding "b" 
// ex: if the id is bmyboard use myboard
var board_name = 'myboard';

// Enter the full path to the directory where your .css files are located
var css_base = 'http://myserver.com/forum/css/';


// Don't modify code below unless you understand the JavaScript used.
var reg_ex = new RegExp("^(http:\\/\\/p\\d+\\.ezboard.com\\/)([bf]" + board_name + "((frm\\d+)|[^.?]+)?)([.?]|$)", "i"); // assemble RegExp
var page_url = new String(self.location); // grab URL as a string
reg_ex.test(page_url);
var css = RegExp.$2 + ".css";
var style_sheet = '<link rel="stylesheet" href="' + css_base + css + '">';

document.write(style_sheet); 

Edited by: Nutrocker at: 6/29/04 2:01 pm

  reply to this message

atlass

ezboard Moderator
ezSupporter
Posts: 2802
Posted: 7/10/03 7:22 am    
Re: Specific CSS assigned to forums
a final note - the script must be enclosed in script tags, or saved as a .js* file and linked to.

   <script language="javascript" src="http://www.YOUR_SERVER_HERE.com/forumcss.js"></script>

or 

<script language="JavaScript">
// Enter your boards id without the preceding "b" 
// ex: if the id is bmyboard use myboard
var board_name = 'myboard';

// Enter the full path to the directory where your .css files are located
var css_base = 'http://myserver.com/forum/css/';


// Don't modify code below unless you understand the JavaScript used.
var reg_ex = new RegExp("^(http:\\/\\/p\\d+\\.ezboard.com\\/)([bf]" + board_name + "((frm\\d+)|[^.?]+)?)([.?]|$)", "i"); // assemble RegExp
var page_url = new String(self.location); // grab URL as a string
reg_ex.test(page_url);
var css = RegExp.$2 + ".css";
var style_sheet = '<link rel="stylesheet" href="' + css_base + css + '">';

document.write(style_sheet); 
</script>



To make a .js file just use notepad, paste the code in, then save it as forumcss.js (or any name you wish to use)

Edited by: Nutrocker at: 6/29/04 2:02 pm

  reply to this message

Nutrocker

ezboard Moderator
ezSupporter
Posts: 11989
Posted: 4/25/04 3:48 pm    
Re: Specific CSS assigned to forums
Update:
29 June 2004
Ezboard moves boards from the old 'pub' servers to new 'b' servers and then later to the newer 'p' servers.
I have adapted the script, yet again, to enable it to parse the new server url's correctly.


Update:
25 April 2004
Ezboard moves boards from the old 'pub' servers to new 'b' servers.
I have adapted the script to enable it to parse the new server url's correctly.

Nutrocker

Edited by: Nutrocker at: 6/29/04 2:04 pm

  reply to this message

Click to receive email notification of replies Click to stop receiving email notification of replies email this topic to a friend

New Topic    Add Reply

jump to:
Topic Control Image::: Topic Commands
<< Prev Topic | Next Topic >>

Icon Legend

reply button:::Reply to Post Button   edit button:::Edit Post Button  delete button:::Delete Post Button (Moderator Only)

subscribe/unsubscribe to thread button:::Subscribe to Thread Button   email to friend button:::Email to Friend Button  



- Cool Tips & Tricks - CSS FAQ -

Communitiesezboard Help Communities:

Help Forums Help Forums Bug Base Bug Base





Powered By ezboard® Ver. 7.32
Copyright ©1999-2007 ezboard, Inc.