View Full Version : Response.Write Syntax
webmarkart
11-02-2002, 05:55 AM
I am trying to dynamically call an include file, but I can't figure out the correct synax. Here is the code I have so far...
<%
ArtNo = Trim(Request("artno"))
Response.Write "<!--#include file=articles" & ArtNo & ".inc'-->"
%>
When I use this it writes it commented out in html. In other words its hidden rather than recognizing it as an include file. What is the correct syntax?
Mhtml
11-02-2002, 06:44 AM
You can not write an include file to the doument, all includes must be stated in the document before it is opened, this means you can not insert values into the file="" part.
You can however do it like this,
<%SELECT CASE Artno%>
<%Case 1 %>
<!---#include file="articles1.inc" --->
<%Case 2 %>
<!---#include file="articles2.inc" --->
<%END SELECT%>
But judging from what your example code was this would not work because you may have more than maybe 20 articles, correct?
Sorry to say but Including files just isnt the way to go for this, why not use a database for this? I just created a news management script which gets news and adds news, you can search for news by month and year and show the latest 5 articles or more...
But this is all under the assumption that you are publishing something like articles of news as an example..
You could also have a script which would create the articles as a html file and the using your ArtNo redirect to the appropriate article which you could inlcude a header footer etc;
webmarkart
11-02-2002, 06:51 AM
Unfortunately I didn't think it was going to work (especially after a half hour of trying) but I figured I'd ask anyway. I will probably end up making a db but it wasn't my first choice. Like you said though I can utilize a search feature a through a db so I guess its better that way.
Its only a personal site so I don't need to go crazy, but I'm trying to develop the entire site with CSS layout rather than tables (which is very new to me!). I wanted to do some experimental things with it so we'll see what I come up with...
You can ignore the content, but what do you think of the CSS layout, and does it work proberly in your browser? I tried to make it browser friendly as possible....
www.webmarkart.com/because
Mhtml
11-02-2002, 06:58 AM
I'm using IE6 so the CSS features work well. I am divided on CSS positioning though, won't display properly at all screen resoloutions..
Looks good though, checkout http://www.microbians.com the dropdown is done with CSS I pulled it apart last night, neat trick!
Mhtml
11-02-2002, 07:01 AM
If your screen res is 800x600 or less you may need to go to fullscreen mode (F11)
BigDaddy
11-04-2002, 04:20 AM
How about calling a sub. It won't run and include the file unless the sub is called.
whammy
11-05-2002, 12:19 AM
If you're going to insert articles to a page, there's little doubt that you should create a database - even if it's just an "article ID" and the associated article which allows you to display that article on your page with a querystring.
I'm totally with Mhtml on this. :)
webmarkart
11-05-2002, 12:51 AM
Sorry, I should have followed up sooner... I did create a database afterall. This way its easier to update and there are a lot more functionalities I can incorporate (such as the search feature)... Thanks
whammy
11-05-2002, 12:52 AM
Cool, thanks for replying, since that lets everyone know you have the situation under control.
I'll close the thread now, if you have any other questions, just start a new thread. :D
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.