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/Code)
 MOD: No forum code parsing in [code] boxes
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

aspwiz
Junior Member

250 Posts

Posted - 25 November 2004 :  14:00:19  Show Profile  Visit aspwiz's Homepage
Have you ever put stuff in code boxes, only to have forum code applied to the contents of the code box? when pasting code into the boxes, often they may have url's or other things that would be acted upon by forum code.

This mod basically makes sure everything in [.code] [/.code] boxes remains exactly intact... forum code will not be parsed inside the tags.

BEGIN MOD [UPDATED FOR BASE CODE INSTALL]

Firstly, add the following variable declaration to config.asp:-
Dim CloakString
open inc_func_common.asp and add these two functions (They can go pretty much anywhere.... I put mine at the end of the file):-
Function Cloak(fstring)
	set re = new RegExp
	re.pattern = "\[code\]([\s\S]+?)\[/code\]"
	re.ignorecase = true
	re.global = true
	set matches = re.execute(fstring) ' find matches
	if matches.count <> 0 then
		for each match in matches
			cloakstring = cloakstring & "!£$%^&*()_+" & match.value ' full match including tags
			fstring = replace(fstring,match.value,"xxxCODEBOXxxx",1,1)
		next
	end if
	Cloak = fstring
	set re = nothing
	set matches = nothing
end function

Function DeCloak(Fstring)
	cloakarray = split(cloakstring,"!£$%^&*()_+")
	for cntr = 1 to ubound(cloakarray)
		fstring = replace(fstring,"xxxCODEBOXxxx", cloakarray(cntr),1,1)
	next
	decloak = fstring
end function
Still inside inc_func_common.asp, find the function called formatstr and then, find this line within it:-
fString = ReplaceURLs(fString)
insert this directly BEFORE that line
fstring = Cloak(fstring) 'Remove code tag content to prevent forum code formatting
next, find this line a few lines down:-
fString = ReplaceCodeTags(fString)
and REMOVE IT.
Lastly, find this line at the end of the the function:-
FormatStr = fString
just BEFORE that line, add these two lines of code:
fstring = decloak(fstring) ' put back the code tags and content
fString = ReplaceCodeTags(fString)


Voila!!!

Enjoy!

Edited by - aspwiz on 27 November 2004 07:12:11

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 25 November 2004 :  14:19:39  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
Sweet I've been meaning to do something like this...

Nice

-Stim
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 25 November 2004 :  16:50:55  Show Profile  Visit dayve's Homepage
quote:
Originally posted by Da_Stimulator

Sweet I've been meaning to do something like this...

Nice


you and me both... I'm glad someone has finally decided to get this done. I'm going to test it right now.

Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 25 November 2004 :  16:56:13  Show Profile  Visit dayve's Homepage
fString = ChkAHREFs(fString) does not exist... or I am very tired today and I am missing it.

Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 25 November 2004 :  17:24:20  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
perhaps in base code it'd be edit_hrefs or ChkURLs....

-Stim

Edited by - Da_Stimulator on 25 November 2004 17:24:38
Go to Top of Page

aspwiz
Junior Member

250 Posts

Posted - 26 November 2004 :  05:22:24  Show Profile  Visit aspwiz's Homepage
basically enter that line before any forum code parsing....

I know my forum has changed a hell of a lot from the base code.

Let me know if you get it going on base code, and what amendments i should make to the instructions above.
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 26 November 2004 :  11:32:51  Show Profile  Visit dayve's Homepage
I may have done something wrong (as mine is also heavily modified), but my code box now produces this text:

xxxCODEBOXxxx

I think I am going to actually spend time examining what it is your code does before I apply it again.


Edited by - dayve on 26 November 2004 11:33:21
Go to Top of Page

aspwiz
Junior Member

250 Posts

Posted - 26 November 2004 :  11:34:26  Show Profile  Visit aspwiz's Homepage
dayve, I think you may have forgot to add the decloak function call just before the formatstr function ends.
Go to Top of Page

MarcelG
Retired Support Moderator

Netherlands
2625 Posts

Posted - 26 November 2004 :  14:45:44  Show Profile  Visit MarcelG's Homepage
whooohooo!!! working as a charm!
To get it into the basecode you need to change the step concerning the chkAHREFs(fString) and use line of
if strAllowForumCode = "1" then

Afaik that's in the basecode, just before
fString = ReplaceURLs(fString)


However, it does change the [b][/b] tags into <b></b> ...
I also had to move the Dim Cloakstring line to config.asp, instead of inc_func_common.asp to get it working for more than 1 minute... After some time it gave me the error 'Name redefined'....

Demo: http://www.oxle.nl/topic.asp?TOPIC_ID=1767

portfolio - linkshrinker - oxle - twitter

Edited by - MarcelG on 26 November 2004 15:03:34
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 26 November 2004 :  15:19:23  Show Profile
Definetly a good mod. Will install it when you all work out the little bugs.

Support Snitz Forums
Go to Top of Page

Gargoyle
Junior Member

USA
280 Posts

Posted - 26 November 2004 :  18:21:25  Show Profile  Visit Gargoyle's Homepage
As will I. Great idea!

Here is a link to my Snitz powered Drag Racing site.
Go to Top of Page

aspwiz
Junior Member

250 Posts

Posted - 27 November 2004 :  07:13:51  Show Profile  Visit aspwiz's Homepage
Ok.... I updated the instructions above, and everything will go fine now I hope.

Let me have any feedback.

Rob
Go to Top of Page

Neilr
Junior Member

Australia
107 Posts

Posted - 01 December 2004 :  07:09:15  Show Profile  Visit Neilr's Homepage
Hi,

This is a great tool as we run comps where the member needs to include a standard image. This way we can give them the code to insert.

I can follow most of it except where to put this bit of code:

Dim CloakString

I know it says in the config.asp file but exactly where? All looks a dangerous for me to be fiddling about in that file. I am using 3.4.05

Tar

Neil.
Go to Top of Page

MarcelG
Retired Support Moderator

Netherlands
2625 Posts

Posted - 01 December 2004 :  07:50:20  Show Profile  Visit MarcelG's Homepage
You can put it just after all the other lines saying DIM whatever

portfolio - linkshrinker - oxle - twitter
Go to Top of Page

Neilr
Junior Member

Australia
107 Posts

Posted - 02 December 2004 :  00:27:39  Show Profile  Visit Neilr's Homepage
quote:
Originally posted by marcelgoertz

You can put it just after all the other lines saying DIM whatever



Sweet: that did it and it works a treat.. Thanks.

Neil
Go to Top of Page

Neilr
Junior Member

Australia
107 Posts

Posted - 02 December 2004 :  00:31:42  Show Profile  Visit Neilr's Homepage
Oh forgot

How did you do the nice box thingie on your site? in the demo link I mean: I like that.

Neil
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.18 seconds. Powered By: Snitz Forums 2000 Version 3.4.07