Author |
Topic |
work mule
Senior Member
USA
1358 Posts |
Posted - 09 August 2001 : 19:02:20
|
SNITZ FORUMS CSS CONVERSION
Now you can convert to CSS today!! No more waiting...
DOWNLOAD "Unofficial" CSS version of Snitz ver 3.3.03 Converted .asp files for Snitz version 3.3.03 http://www.scalemodelernetwork.com/downloads/snitz/sf2k_v33_033_css.zip See post dated 22 August 2001 : 10:49:21 for the post conversion changes that should be made before using. (Release Date: Aug 22, 2001)
DOWNLOAD Conversion Script http://www.scalemodelernetwork.com/downloads/snitz/snitzcss.zip Download this to convert your version of the forum and any mods that you may have. Please read the post conversion readme for modifications that may have to be made after using the conversion script! (Release Date: Aug 09, 2001)
INFORMATION This mod consists of two parts.
1) 1 Copy of the v3.3 SR2 Forum Code converted to CSS (includes only the .asp script files)
2) 1 Copy of the Conversion Script (perlscript)
This mod will allow you to convert your Forums to use CSS in place of <font> tags and html bgcolor attributes. The Conversion script is written in Perl and will require that you have Perl installed to run it. If you don't have Perl, there is a copy of the most recent release of Snitz which has been run through the conversion script.
The script is pointed to a source directory in which it looks through, loads each text file, parses through it and then writes out a copy to a destination directory (thus making a new copy).
The script utilizes a data file which it imports and uses to perform the conversion. Each line in the data file consists of two strings separated by a tab character. When the script is run, it simple replaces any instance of the first string with the second string. In this case, the data file contains all the instances of <font> tags and bgcolor. It replaces the <font> tags with span with a css class and the bgcolor with a css class.
The CSS classes are very similiar to The Writer and were my choices. Where I could, I defined classes with simple names like "default" or "category". Other places where there was a mixture of something like the Header Font Size, the Default Font Face and maybe Footer Font Color, it was difficult to really categorize it, so I made a simple naming convention:
class name = xxyyzz
xx - Font Size yy - Font Color zz - Font Face
So for something like the following: <font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>" color="<% =strForumFontColor %>">
The class was named: ftfrdf (What else could I do?)
I have provided the external css stylesheet (written in asp) which should be in sync with the data file. Like I stated before, these were my choices, I'm not going to argue if they're right or wrong. They're not set in stone. You can open up the datafile and the stylesheet and change the class names to whatever you desire.
The data file contains all the different combinations/variations of font tags that I've come across. It did cover an early version of the calendar, PM, and a couple of other mods, in addition to the 3.3 release. If you come across new variations, just update the data file. You can do a directory search against your forum looking for unconverted <font> tags and add them to the data file.
Very Important Note!! If you do use this, make sure you follow the post_conversion instructions. You will need to go back and replace the forum code lines with the code from the original file. This is because the forum code (forum code = [] markup) converts to <font> tags. You will need to keep using them inside the forum code otherwise the messages stored inside your database will be out of sync!
STATISTICS
In the unmodified Snitz Forums v3.3 SR2
Search for "<font" - Found 1748 occurrence(s) in 68 file(s) Search for "bgcolor" - Found 1247 occurrence(s) in 59 file(s)
I ran this script on a Pentium III 600.
Number of string conversions in from the data file: 260 Number of files converted: 77 Number of lines of code: 30516 Time for conversion (sec): 5
Basically this script is nothing more than a batch Find & Replace. So to put this simply, this script performed 260 Find & Replace actions over 77 files consisting of 30,000+ lines of code in 5 seconds. Perl is so awesome!!
IN CLOSING... I'm not here to argue about CSS usage. I'm doing this as a service to the community and providing a utility to allow people the ability to quickly convert their forum to CSS. This is the same CSS method I use on The Writer and until someone shows me otherwise, it works!!
I use this script all the time. I maintain the development copy in the <font> tag style so that I can easily adopt in new mods. Before I migrate the base code to other forums, I parse it through the perlscript and then run a batch file to update the webservers.
Happy Mod'ing
The Work Mule Forums The Writer Community
Edited by - work mule on 22 August 2001 11:00:48 |
|
@tomic
Senior Member
USA
1790 Posts |
Posted - 09 August 2001 : 19:28:22
|
Yes!!! Thank you!!!
@tomic
|
|
|
RDoGG™
Junior Member
USA
329 Posts |
Posted - 09 August 2001 : 19:32:00
|
You are the man, work mule!
Thanks a bunch.
Does Perl work on PWS? Can you maybe convert this perlscript to ASP?
Thanks again,
RDoGG™ |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
|
RDoGG™
Junior Member
USA
329 Posts |
Posted - 09 August 2001 : 19:51:24
|
hey. i d/l'ed ActivePerl (thanks, RK), and set everything up.
i ran conversion.pl in DOS (didn't mean to) and everything went great.
i went to my "css-ized" website and saw everything white!
i think i forgot to include the .css file.
you should put that in the instructions.
besides that, EXCELLENT MOD!
thanks a lot. rock on!
RDoGG™ |
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 09 August 2001 : 20:09:54
|
Thanks Richard for adding the link for ActivePerl.
quote:
i went to my "css-ized" website and saw everything white!
i think i forgot to include the .css file.
you should put that in the instructions.
You'll need to add in the reference to the external stylesheet and also make sure to copy over the external stylesheet that was in the zip file. If you see white, it's a good thing! It means that the <font> and bgcolor html has been removed and you're site is now using CSS.
from the readme.txt file:
EXTERNAL CSS FILE
Place the forum_css_stylesheet.asp in the main forum directory.
In inc_top.asp and inc_top_short.asp, place the following line of code in the <head> section of the html.
<!-- SITE & FORUM STYLESHEET (CSS) --> <link rel="stylesheet" type="text/css" href="forum_css_stylesheet.asp" title="<%=strForumTitle%> Stylesheet" />
My theory is that this external stylesheet should only have to be served once per session. Hopefully this file gets stored in the browser's cache and used from cache until it expires from the browser's cache. The expiration can be adjusted by modifying this statement: response.expires = 1440
If you don't expect to be making major changes, set it high. For development, set it to 0 or -1.
The Work Mule Forums The Writer Community
Edited by - work mule on 09 August 2001 20:19:33 |
|
|
RDoGG™
Junior Member
USA
329 Posts |
Posted - 09 August 2001 : 20:51:05
|
you are the greatest, work mule.
thanks for the perlscript.
i am making edits based on original coding (<font> tags) and putting it in a new file called "updates.txt" so that when the 3.3 service release (with bug fixes) comes out, i'll update it with my changes, then run it by the CONVERSION.
ahhh! i have to get used to the class names now!
thanks again,
RDoGG™ |
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 10 August 2001 : 10:03:48
|
Thank you, RDoGG™.
I wrote this script and have been using it since Feb. I was hesitant to release it earlier because I was still new to the forums and I didn't know if anyone had been working on CSS and some standards for CSS in Snitz. I didn't know how much time would be spent trying to document, explain and support this and I also didn't want to become a Perl HelpDesk.
A little insight into why I released it. I've seen discussions about CSS in the past and I guess I'm tired of seeing it be only discussion and also fustrated by people saying it can't be done when I've been doing it since the beginning of the year.
I'm aware of the fact that CSS was the next thing after Internationalization effort. I debated 'bout releasing this, not knowing if it would conflict with anyone's work (I apologize if it does). However, I know people have been asking 'bout CSS and with Internationalization taking precedence, it could be awhile before development begins on the CSS version.
With the work that I've done with this script and compiling the data file, I've made it easy for Snitz to convert to CSS. Now anyone can do it. Granted there is more to CSS than converting font tags and backgrounds to CSS, but the way I see it, that's the bulk of it. Yes, there's some additional work that can be done by going back and tweaking more by hand, but this gets the job done until the base code is officially converted to CSS.
The Work Mule Forums The Writer Community
|
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 10 August 2001 : 10:05:10
|
I think I mentioned this in the readme file(s), but I think it's important. When editing the data file, remember the following:
1) The two strings are tab-delimited, that is separate the strings by a tab character.
2) Be aware of the context that the strings will be used in. If you know that it's going to be used in an HTML context, then the replacement string can be something like: <span class="classname"> . However, if there's any question about it being used in the context of ASP, then either the double quote characters have to be escaped (two double quotes) or use a single quote. If the string is going to be Javascript, then you have to escape the single quote or use double quotes.
Something I wasn't consistant about was the use of single or double quotes in conversion. Personally I favor double quotes (personal preference, no technical justification) but thinking 'bout it now, maybe I should have just used single quotes everywhere. The only possible benefit is that if double quotes were HTML and single quotes were ASP, then it may be possible to convert from CSS back to <font> tags. But why would anyone want to do that??
The Work Mule Forums The Writer Community
|
|
|
@tomic
Senior Member
USA
1790 Posts |
Posted - 10 August 2001 : 15:21:13
|
You know, I love CSS but have been somewhat reluctant to implement it because of worries that some browsers wouldn't handle it well if at all. But I checked out your Writer Mag site with a variety of browsers(IE, NS,Opera) and everything stayed consistent. Very, very nice work there!
@tomic
|
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 10 August 2001 : 16:31:47
|
Thank you.
I've been looking through our site logs and a lot of the pre 4.x are almost non-existant. Across quite a few of our sites, combined, they come in well under 5% of our traffic. I'm not too concerned about making pretty pages for pre 4.x browsers anymore. As long as they're readable and functional (to a degree), that's all that matters for that segment of our users.
The important thing for background colors and font colors is to either use all CSS or all HTML. If you use HTML black for the background and default black for text, and rely on CSS to make text white, then that user with the browser that doesn't support CSS will not be able to see the text. Looking at The Writer with CSS turned off, the site may be all white, but it's still useable and readable.
The Work Mule Forums The Writer Community
|
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 12 August 2001 : 01:11:31
|
Anybody else use this yet? (Just curious) |
|
|
Jeepaholic
Average Member
USA
697 Posts |
Posted - 12 August 2001 : 03:55:23
|
Wow...this is gonna be a really good mod for me. Thanks! Out of curiosity...can the auto-script NOT be written in ASP? Just wondering.
Al Bsharah Jeepaholics Anonymous |
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 12 August 2001 : 15:10:36
|
quote:
...can the auto-script NOT be written in ASP? Just wondering.
Which script? The conversion script or the external css file?
The conversion script (which is in perl) probably could be written in ASP/VBScript, however it's not something I honestly would have any desire to write. An ASP/VBScript version, while doable, would be slower and not as efficient as Perl.
If someone would attempt to convert the script to something else, I would recommend using Javascript for the scripting language over VBScript.
The Work Mule Forums The Writer Community
|
|
|
RDoGG™
Junior Member
USA
329 Posts |
Posted - 17 August 2001 : 23:22:36
|
how do i remove the annoying navy underline under the category name?
RDoGG™ |
|
|
work mule
Senior Member
USA
1358 Posts |
Posted - 17 August 2001 : 23:45:00
|
quote:
how do i remove the annoying navy underline under the category name?
Whatever class it is, add in "text-decoration:none;" to either the class or the inline style.
|
|
|
Topic |
|