Using contents of a database field to change URL of "included" fil

M

Meemers

Is it possible to use the contents of a database field to modify the URL of
an "included" file. I need to pull a file from different folders, where the
folder name = field contents. ie if field content = "12345", then I want to
INCLUDE the file 12345/file.htm (The filename is the same in each folder)
THis is frustrating me beyond belief! Help please
 
K

Kevin Spencer

If you're talking about a server-side include, such as an ASP include, it's
not possible. An include directive is a pre-processor directive. It includes
whatever code is in the included file into the current file BEFORE executing
any code. The only way to do what you're describing would be to change from
using an include to using some sort of programming to dynamically include
content, rather than a server-side include.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
M

Meemers

can you help point me to where I can find such programming?
--
Hopeful Thanks
Meemers


Kevin Spencer said:
If you're talking about a server-side include, such as an ASP include, it's
not possible. An include directive is a pre-processor directive. It includes
whatever code is in the included file into the current file BEFORE executing
any code. The only way to do what you're describing would be to change from
using an include to using some sort of programming to dynamically include
content, rather than a server-side include.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
R

Ronx

Google for File System Object which can be used to open files and
"write" them into the HTML stream sent to the browser.
Example:

fnme="/includes/includefile.txt"
set objFSO = Server.CreateObject("Scripting.FileSystemObject")
fnme = Server.MapPath(fnme)
if obj2FSO.FileExists(fnme) then
set objText = obj2FSO.OpenTextFile(fnme)
getFileContents = objText.ReadAll
objText.Close
set objText = Nothing
response.write getFileContents
end if
set objFSO = Nothing


--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

http://www.rxs-enterprises.org/fp




can you help point me to where I can find such programming?
 
R

Ronx

PS - The method in my previous post will only work for pure HTML or text
files. Any server side scripts in the file will not be run.
--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

http://www.rxs-enterprises.org/fp
 
T

Thomas A. Rowe

Are you using a form post method to retrieve the folder name from the database?

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 
M

Meemers

That's exactly what I'm trying to do. THe visitor clicks on an ID number in a
form to select the ID, which posts to the form results page, where a
paragraph of text is to be displayed along with some images. I can get the
images to display correctly, but not the text.
--
Hopeful Thanks
Meemers


Thomas A. Rowe said:
Are you using a form post method to retrieve the folder name from the database?

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top