Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to exec #include file

Status
Not open for further replies.

eirikr

Programmer
Oct 31, 2008
15
US
hello all
i have a guest_link table with a column "contents" has value: <-- #include file="guest.inc" -->

in my asp code, i pull that data out of database
<%=contents%> and i expect it'll call that file.inc, but it does not.
Instead it gives me a text string printed on the screen <-- #include ... -->

Do you know how to call the .inc file
Thanks
 
you need to parse out the file you want to include and execute it instead of including it....

Someone should be able to make this step easier with a RegEx - I should learn how to do them, but that's what I rely on these forums for...

Code:
' if "contents" = "<-- #include file="guest.inc" -->"

ra = split(contents,"""")
ra2 = split(ra(1),"""")
contents = ra2(0)
erase ra
erase ra2

^ "contents" will now be equal to "guest.inc" - we've just removed everything else around it with a couple of splits.

Next, execute it instead of response.write(ing)

Code:
<% server.execute(contents) %>


TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top