Adding CSS to links - Posted (1254 Views)
Senior Member
leatherlips
Posts: 1838
1838
I'm trying to add some css code to hyperlinks that members may post in my forum.
I'm probaly going about this the wrong way but here is what I am trying to do.
Normally in html, I would do this:

<a href="http://www.link.com" rel="example[width height]"</a>

I'm trying to make a tag that I'm currently calling [tag] [/tag].
I've then in inc_func_common.asp added this line with the other forum code entries:

fString = doCode(fString, "[tag]", "[/tag]", "<a href=", " rel=""example[width height]""></a>")

However, after I put my [tag] [/tag] before and after my hyperlink, the link just disappears.
What would be the proper way to have a tag automatically add the part in red above? <
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Average Member
cripto9t
Posts: 881
881
I think your going about it the wrong way.
I would copy the "ReplaceURLs" function in "inc_func_common" and rename it, "ReplaceTags" or what ever you want. Then change these lines
Code:
	oTag = "[ url="""
c1Tag = """]"
oTag2 = "[ url ]"
c2Tag = "[ /url ]"

roTag = "<a href="""
rc1Tag = """ target=""_blank"">"
rc2Tag = "</a>"
and change them to what you need
Code:
	oTag = "[tag="""
c1Tag = """]"
oTag2 = "[tag]"
c2Tag = "[/tag]"

roTag = "<a href="""
rc1Tag = """ target=""_blank"" add you html here>"
rc2Tag = "</a>"
I searched through it and you'll need to change this line to
Code:
'if the closing url tag is found in the string and
'[ URL ] is not found in the string then... If InStr(1, strArray2(1), c2Tag, 1) And _
Not InStr(1, UCase(strArray2(1)), "[ URL ]", 1) Then
Change that to [TAG] - uppercase.
Then you can call it in the formatrStr() function
Code:
	if strAllowForumCode = "1" then
fString = ReplaceURLs(fString)
fString = ReplaceTags(fString) fString = ReplaceCodeTags(fString)
if strIMGInPosts = "1" then
fString = ReplaceImageTags(fString)
end if
end if
that way you'll have 2 functions "ReplaceURLs()" for your regular links and "ReplaceTags()" to deal with you special links.
There may be more to it than this, but it's a start. <
    _-/Cripto9t\-_
 
You Must enter a message