Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Different [code] tag
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

Dan Martin
Average Member

USA
528 Posts

Posted - 21 July 2002 :  03:41:46  Show Profile  Visit Dan Martin's Homepage  Send Dan Martin an AOL message  Send Dan Martin an ICQ Message  Send Dan Martin a Yahoo! Message
I'm tinkering with changing the [code] tag. I really like how they show code here:
http://www.dynamicdrive.com/dynamicindex5/linkinfo.htm

Their textarea is defined like this:
<textarea rows="8" name="final2" cols="45" wrap="virtual" style="width:98%">

Which is cool, because it resizes. No more entire threads becoming 5 pages wide. Also it's much easier to copy and paste these.

I thought I could pull it off by changing the [code] tag handling in inc_functions. Well, it worked, except that you need to Server.HTMLEncode the data between the tags. Anyone have an idea how I could do that?

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 21 July 2002 :  06:32:22  Show Profile  Visit HuwR's Homepage
Rather tha change the functionality of the forums [ code ] tag, you would be better making your own additional tag, that way you won't break anything in the forum while you are getting it to work.

what problem do you have with HTMLEncoding the message ?

Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 21 July 2002 :  14:02:32  Show Profile  Visit dayve's Homepage
hey dan, kind of an interesting idea, but maybe use a DIV instead.

<div style="overflow:scroll;width:100%;height:100%;">

just a thought. it can be tweaked quite nicely too.


http://www.nineinchnailz.com
Go to Top of Page

Dan Martin
Average Member

USA
528 Posts

Posted - 21 July 2002 :  19:46:28  Show Profile  Visit Dan Martin's Homepage  Send Dan Martin an AOL message  Send Dan Martin an ICQ Message  Send Dan Martin a Yahoo! Message
quote:
you would be better making your own additional tag, that way you won't break anything in the forum while you are getting it to work.

I thought of that. However, if you keep the old decode statement, change the encode statement, and add your own decode statement, everything works fine. If someone edits or quotes a message with a code chunk, it will decode back fine, but after the editing it will end up with the new format. I hope that makes sense, but I can give a better explanation if it doesn't.
quote:
what problem do you have with HTMLEncoding the message ?

Well, actually I was mistaken. Currently the linefeeds are getting converted to <BR> tags, but then show up in the textarea as <BR> instead of linefeeds.

Dayve, I tried your suggestion. It works, and I prefer the way it looks. But it loses the benefit of easier "Select All". In fact, selecting the code can be difficult. I also still have the issue with the proper formatting.

If you want to see it, here's examples of both: http://danknows.com/forum/topic.asp?TOPIC_ID=7

My cable modem has been in and out all day. So if that link isn't working, I apologize.

Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 21 July 2002 :  20:43:34  Show Profile  Visit HuwR's Homepage
quote:

I thought of that. However, if you keep the old decode statement, change the encode statement, and add your own decode statement, everything works fine. If someone edits or quotes a message with a code chunk, it will decode back fine, but after the editing it will end up with the new format. I hope that makes sense, but I can give a better explanation if it doesn't.


That wasn't the reason I suggested it, but so that you can use both, if you are only posting 2 ior 3 short lines, why would you want a scrolling area.

Go to Top of Page

Dan Martin
Average Member

USA
528 Posts

Posted - 21 July 2002 :  21:01:39  Show Profile  Visit Dan Martin's Homepage  Send Dan Martin an AOL message  Send Dan Martin an ICQ Message  Send Dan Martin a Yahoo! Message
Two reasons.
1) Code, no matter how many lines, in it's current form can force a thread to be wider than the page. This, as I'm sure you'll agree, can make a thread difficult to read
2) The current code chunks copy and paste badly. When I copy and paste them into a normal text editor, I end up with all the lines mashed into 1 line.

I personally am looking to change the old tag to get rid of these problems.

Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 21 July 2002 :  21:19:35  Show Profile
When I write html pages that provide scripting tutorials, I put the code parts in a text box also if the intention will be that the person needs to copy and paste the code. However, if the intention is just to read the code to get, have to scroll makes it difficult to see the entire picture. You could maybe do different code options based on if the code is for viewing or for pasting. Or, as far as the scrolling goes, you could maybe only have it display the horizontal scrollbar if needed.

Nikkol
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 21 July 2002 :  21:30:32  Show Profile
About those <br> and <p> tags, can't you filter them out before displaying the code by using a replace function, like this:


Replace(This_Song.Fields.Item("LYRICS").Value, "<br>", vbcrlf)
Replace(This_Song.Fields.Item("LYRICS").Value, "<p>", vbcrlf)
Replace(This_Song.Fields.Item("LYRICS").Value, "</p>", vbcrlf)


This code is actually a modified part of my lyrics pages, but I'm sure you get the idea

Roland

http://www.frutzle.com

Snitz Exchange | Do's and Dont's
Go to Top of Page

Dan Martin
Average Member

USA
528 Posts

Posted - 21 July 2002 :  23:06:29  Show Profile  Visit Dan Martin's Homepage  Send Dan Martin an AOL message  Send Dan Martin an ICQ Message  Send Dan Martin a Yahoo! Message
I understand that. But how do I do it in docode() in inc_functions, for just the portion of the post between [ code ] and [/code] tags?

Edited by - Dan Martin on 21 July 2002 23:08:55
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 21 July 2002 :  23:27:37  Show Profile
Good question...

Tomorrow will be a nice dry day although in your area it might rain a lot. Temperatures vary between 20 and 120 degrees Fahrenheit, depending on your location. Back to the studio...

Roland

http://www.frutzle.com

Snitz Exchange | Snitz Icons | Do's and Dont's
Go to Top of Page

Dan Martin
Average Member

USA
528 Posts

Posted - 21 July 2002 :  23:29:31  Show Profile  Visit Dan Martin's Homepage  Send Dan Martin an AOL message  Send Dan Martin an ICQ Message  Send Dan Martin a Yahoo! Message
Um....did Frutz just lose it before our eyes?

Go to Top of Page

Deleted
deleted

4116 Posts

Posted - 22 July 2002 :  00:04:52  Show Profile
LOL. Perhaps it is too hot there and he walked under the sun too much :)

Think Pink
==> Start Internationalization Here
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 22 July 2002 :  00:07:35  Show Profile
Well, it was late (and is even later now), but I was trying to say "I have no clue about it at all so I'd rather have someone else answer your question"

Roland

http://www.frutzle.com

Snitz Exchange | Snitz Icons | Do's and Dont's
Go to Top of Page

Deleted
deleted

4116 Posts

Posted - 22 July 2002 :  00:37:19  Show Profile
Not tested, but one char + or - ... Just get the idea...


function doCode(fString, fOTag, fCTag, fROTag, fRCTag)
DIM s
fOTagPos = Instr(1, fString, fOTag, 1)
fCTagPos = Instr(1, fString, fCTag, 1)
while (fCTagPos > 0 and fOTagPos > 0)
if f0tag = "[NEWCODE]" then
s = mid(fString, fOTagPos + len(fOTag), fCTagPos - fOTagPos - len(fOTag))
s = replace(s,"<br>", vbCrLf)
s = replace(s,"<p>" , vbCrLf)
s = replace(s,"</p>", vbCrLf)
' so the following also strips out the tags
fString = left(fString, f0TagPos-1) & s & mid(fString,fCTagPos + len(fCTag) + 1)
fOTagPos = Instr(1, fString, fOTag, 1)
fCTagPos = Instr(1, fString, fCTag, 1)
else
fString = replace(fString, fOTag, fROTag, 1, 1, 1)
fString = replace(fString, fCTag, fRCTag, 1, 1, 1)
fOTagPos = Instr(1, fString, fOTag, 1)
fCTagPos = Instr(1, fString, fCTag, 1)
end if
wend
doCode = fString
end function



Think Pink
==> Start Internationalization Here

Edited by - bozden on 22 July 2002 00:40:18
Go to Top of Page

Deleted
deleted

4116 Posts

Posted - 22 July 2002 :  01:16:03  Show Profile
Well, it is much better to define a new function doNewCode(fString) and call it from chkString once. You will also add other starting/ending there (given above).


Think Pink
==> Start Internationalization Here
Go to Top of Page

James
Average Member

USA
539 Posts

Posted - 22 July 2002 :  21:14:26  Show Profile  Visit James's Homepage
I like how it looks beter in the second example. Also, you might consider adding a header that lets the reader know that it's code above the text box.

Also, how well do you have this working if several people posts code in a thread, or if a user posted snippets of code with text between different parts (as we currently do with several code /code tags in a message). Just curious if it poses a problem or not.

-
*Interested in Radio Control*
*The RC Web Board - http://www.rcwebboard.com/*
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07