Forum Moderators: open

Message Too Old, No Replies

ASP Custom Tags

does ASP even have them?

         

Newnewbie

6:09 pm on Jul 23, 2002 (gmt 0)

10+ Year Member



In Coldfusion you can write a custom tag. This is actually equivalent to a function in other programming languages... Can you do this in ASP? What do you call them in ASP??

smokin

6:18 pm on Jul 23, 2002 (gmt 0)

10+ Year Member



afaik asp doesn't use tags, just a scripting lanuage ie vbscript or javascript,. However it does have it's own object model that uses objects such as Response, ADO etc.

chameleon

6:25 pm on Jul 23, 2002 (gmt 0)

10+ Year Member



No, not really. You can include one piece of ASP code into another, but you don't really have the same input/output scheme like you do in CF.

Newnewbie

7:04 pm on Jul 23, 2002 (gmt 0)

10+ Year Member



Oh, OK, cause I'm looking at this code wondering what it is doing...

<%ecmSearch "StartingFolder",
"Recursive",
"Target Page",
"Text Box",
"MaxCharacters",
"ButtonSource",
"ButtonText",
"FontFace",
"FontColor"
"FontSize",
"Horizontal",
"Spare1",
%>

Dreamquick

7:45 pm on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That ASP code would appear to be calling a routine called "ecmSearch" which takes the text in quotes as its paramters (this is not one of the standard ASP calls as far as I'm aware so I can't help with that), but...

If the code goes as you posted then it wont work because;

1) The last line "Spare1" has a comma after it which does not need to be there and will cause problems running the script

2) ASP code needs to be on a single line unless you manually break it with an underscore e.g. the following is not valid

<%
If VarX = "QWERTY"
And VarY = 180 Then

Response.Write "Pass!"

End If
%>

To make that code work you could write it two ways...

<%
If VarX = "QWERTY" And VarY = 180 Then

Response.Write "Pass!"

End If
%>

or manually escaping the line break

<%
If VarX = "QWERTY" _
And VarY = 180 Then

Response.Write "Pass!"

End If
%>

aspdaddy

12:58 pm on Jul 24, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Newnewbie,

As smokin pointed out, ASP does not support tags. Functions and #includes is a code design issue and not a featuree of ASP.

e.g including this:
<!-- #include virtual ="reuse/error.asp" -->

Would allow your ASP to call functions defined in the error.asp file.

aspdaddy

Newnewbie

7:34 pm on Jul 26, 2002 (gmt 0)

10+ Year Member



Ok, so it's calling a routine... How is that different from a custom tag? Maybe it's just differently terminology. At any rate, it's calling a mini program or perhaps function and passing parameters??

Sorry for the comma, that was my fat fingers...

threecrans

9:29 pm on Jul 31, 2002 (gmt 0)

10+ Year Member



I think the confusion may be derived from the fact that the snippet you posted starts and ends with angled brackets (<% %>), which are used to designate ASP code blocks (thus making the code look like a "tag"). As pointed out before, that function should be rewritten something like the following
<%

ecmSearch "StartingFolder", "Recursive", "Target Page", "Text Box", "MaxCharacters", "ButtonSource", "ButtonText", "FontFace", "FontColor" "FontSize", "Horizontal", "Spare1"

%>

I don't know anything about Cold Fusion custom tags, but they appear (after a quick search) to be somewhat functionally equivalent to COM objects.