0

For some reason, I can include an ASP file with the following code:

<!--# include virtual="/includes/func.asp" -->

But, I have some functions in that file, and I can't call them into my main file. Can someone help? I'm calling them like this:

<% my_func() %>

..and all I get is an error message, with a link to another webpage. Thanks for your help in advance.

osij2is
  • 3,885
  • 2
  • 24
  • 31
willbeeler
  • 235
  • 3
  • 9
  • Thank you for updating my syntax. How did you do that? – willbeeler Sep 21 '09 at 17:19
  • 1
    It's a function of the editor. You can either select it and click Ctrl-K, or select it and click the Binary Format button just above the editor (the button with the 1's and 0's) – squillman Sep 21 '09 at 18:29

1 Answers1

1

In VBScript, you can call functions in a handful of ways;

  1. returnval = functionYaddaYaddaYadda()

  2. functionFoo()

  3. Call functionBar()

You're essentially trying to #2 with shorthand ASP tags. Use:

<%= my_func() %> 

The "=" is the shorthand way of doing:

response.write(my_func()) 

P.S. Check out the MSDN VBScript Reference. There's really not much to VBScript outside of this reference manual. Maybe more elegant tricks but the meat of VBScript can be found on that site.

osij2is
  • 3,885
  • 2
  • 24
  • 31
  • Dude, you rock. Thanks man, I'm a major noob with ASP. I appreciate it. – willbeeler Sep 21 '09 at 18:36
  • No problem, dude. :) I should also note that *ASP* type information isn't found on the MSDN reference link I provided. Just VBScript. You can think of ASP as like a mini layer of frosting on top of the cake that is VBScript. For ASP type info, w3schools (http://www.w3schools.com/asp/asp_intro.asp) would probably be a good place to start if you need ASP-centric info. They too have VBscript programming info should you need it. – osij2is Sep 21 '09 at 18:51