Forums

This topic is locked

ASP code in <#inclde> - doesn't work?

Posted 10 May 2001 02:49:17
1
has voted
10 May 2001 02:49:17 Steve Davis posted:
Hey everyone,

I am trying to do something like this

&lt;!--#include file="templates/&lt;%=table.fields.item("value"%&gt;"&gt;

However, it seems the include statement interprets the script literally as the error I get is:

The include file 'templates/&lt;%=table.fields.item(' was not found.

Being able to do this would be a very, very cool thing for the app I am working on.

For others and maybe put ideas in your head...I have created a "top" and "bottom" of a page and based on the value pulled from the db, would include a specific file in the middle of the page.

It works beautifully if I hard code the include file, now I want it to be dynamic.

I have tried with single and dbl quotes and without. Have also tried putting string into variable first and the using that. All with no success.

Maybe someone has another thought on how to do this.

Me? I can't even spell ASP!

Replies

Replied 14 May 2001 11:55:46
14 May 2001 11:55:46 Waldo Smeets replied:
I am not sure but I remember having read somewhere that dynamic includes are not allowed.

Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------
Replied 15 May 2001 22:17:23
15 May 2001 22:17:23 Quy To replied:
I tried to do dynamic include before. It did not work. I asked other deverlopers; none can explain why. If anyone knows, or has an idea why, pls reply.
What about using IF statements: if recordset is empty, include this; if recordset is not empty, include that. Or, if cookies is exists, include this header, if not, include the other header. Does it work?
-------------------------------------------


www.DUresources.com
-------------------
Home of DUforum & DUpoll
Replied 16 May 2001 01:49:59
16 May 2001 01:49:59 Steve Davis replied:
I think that the problem lies in the include being carried out before the ASP layer is run.

i.e. since, in the include file tehre may be ASP code it is logical that the file must be incorprated then ASP parses the complete final file.

This being the case (and I am making it up based on logic) then any dynamic statements in the actaul include statement won't be interpreted until after teh file is included.

Does that make sense? It is a convoluted theory, but it would explain why we can't do dynamic include statements.

I would be interested in anyone else's thoughts on the idea.

Me? I can't even spell ASP!
Replied 23 May 2001 18:49:40
23 May 2001 18:49:40 carolus Holman replied:
I believe using IIS5.0 you can run a Dnamic Include. I had the same problem and had to find another solution. Find out what version of IIS you are running...Hope that helps
Replied 29 May 2001 04:15:00
29 May 2001 04:15:00 Dylan Marks replied:
There is an article by Rick Curtis on his extreme ultradev site:
www.princeton.edu/~rcurtis/ultradev/tutorial5.html

-Dylan.
Not that I quite understand it yet, as I'm just beginning and still getting PWS errors.

hope that helps!
Replied 30 May 2001 19:22:15
30 May 2001 19:22:15 Dylan Marks replied:
I was reading through the Rick Curtis tutorial that I provided a link for just now. Someone help me out here: The last piece of code that you are supposed to enter (at the end of the article) is
&lt;%whichfile= ArticleLink...

Shouldn't this be ArticleFile instead of ArticleLink?

Reply to this topic