Forums

ASP

This topic is locked

Library function file

Posted 18 May 2006 11:48:56
1
has voted
18 May 2006 11:48:56 Charles Knight posted:
Hi all
Have been trying to make some changes to an auction package. They use what they call a library file, its really just an asp file full of functions.

The site template is in html so you can't add any dynamic content to it but they tell you to alter the library file by adding these lines:

sTemp = "" & psStream
sTemp = Replace(sTemp, "%MYBANNER%", MyBannerFunction)


I have created this it works to a point: (puts the link at the top of the page not were I put the %CUSTOMSEARCH% )

sTemp = replace(sTemp, "%CUSTOMSEARCH%", CustomSearch )
Response.Write sTemp
End Sub

Function CustomSearch
Response.Write "<a href=www.buyfore.com/customsearch2.asp>Custom Search Click here</a>"
End Function


If I try to put anything other than an href link (I want to put an include statement) I either get an error or nothing where the include should be.

Can post the full versions of all the pages if needed,
any thoughts greatly received

Kind regards
ck

Replies

Replied 18 May 2006 11:58:45
18 May 2006 11:58:45 Charles Knight replied:
If I try this:

sTemp = replace(sTemp, "%CUSTOMSEARCH%", CustomSearch )
Response.Write sTemp
End Sub

Function CustomSearch
Response.Write "<!--#include virtual="test.asp"-->"
End Function

I get this error:

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/Auction/APLib.asp, line 210

Response.Write "<!--#include virtual="test.asp"-->"
--------------------------------------^
Replied 18 May 2006 12:01:24
18 May 2006 12:01:24 Charles Knight replied:
If I take out the "" marks around test.asp then I get nothing on the final page (its like the include statement is not being read).

Thanks for any help

ck
Replied 18 May 2006 13:09:27
18 May 2006 13:09:27 Charles Knight replied:
Had another go at this problem and it seems I need to be able to use the #include function inside <% %>
Have tried various example asp scripts like this one:

dim h
h=hour(now())
response.write("<p>" & now())
response.write(" (Norwegian Time) </p>"
If h<12 then
response.write("Good Morning!"
else
response.write("Good day!"
end if


which works fine, but as soon as I try to use the include the problems start.
Replied 24 May 2006 16:27:06
24 May 2006 16:27:06 Patrick Woldberg replied:
You should escape the quotes like

Response.Write "<!--#include virtual=""test.asp""-->"

but I don't think that the include will work this way, it will simply output the string to html and doesn't include the file.

--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Administrator at DMXzone.com, FLzone.net, FWzone.net and DNzone.com
--------------------------------------------------

Reply to this topic