Forum Moderators: phranque

Message Too Old, No Replies

Creating a relational directory structure

the best strategy for creating a static database directory

         

Roosta

11:23 pm on Jan 2, 2004 (gmt 0)

10+ Year Member



After months of reading the posts on this forum it is time for my first- so here goes.
I would like to generate some static pages from my database of about 20,000 products- no problem. But I would like to place each of these products in its own virtual directory which is inherited , e.g foodtypes.com/tropical-fruits/bannanas.htm. Due to the ammount of categories, it would be impossible to do it manually. I have seen lots of DB publishing software that can create pages titled with DB column names, but is there any that will create a vir directory named from the DB as well? Thanks

txbakers

11:26 pm on Jan 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Roosta, glad to have you post.

That's an interesting question. My first thought was no, but then I thought about the FileSystemObject of ASP. I know you can create files with it, but I've never tried doing it with a directory structure. I don't see why you couldn't.

That you could do dynamically.

If you're platform is ASP, take a look at www.w3schools.com and their ASP section. They have a good discussion of the FSO

killroy

9:03 am on Jan 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Since you asked about virtual directories, I asume you do NOT want to use a filesystemobject to create static directories on the OS level (i.e. "real" directories).

mod_rewrite of apache can acces databases directly, or via a script. Which might be a good choice.

Personally I only EVER use virtual directoreis and files. So you can simpel map via mod_rewrite all accesses to a script which then extracts teh directory information and does the DB lookup.

Best Of Luck

SN

aspdaddy

11:45 am on Jan 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It would be painless with the FSO and the ADOX catalog object.

FSO can create all the files and folders and the ADOX is good for pulling out the column names and db structure.

Why not do it this way under Windows (ASP/VBS/or Windows script) and then upload it to your server, this way you dont have to worry about permissions when creating files/folders and the live site is safer from hacks.

Roosta

1:18 pm on Jan 3, 2004 (gmt 0)

10+ Year Member



Some good ideas, thanks. I will have a bash at the FSO using ADOX to connect. Hoping not to have to learn too much ASP, can draw on my old C++ days I suppose and hopefully drill straight down to the oil. Better put the coffee on..

aspdaddy

1:27 pm on Jan 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Good one, have a bash and then post back. Ill happily help as it will be useful to have the code for this.

I dont think it will be much coding at all , but you may need to create all the folders first, before the files, or run it batch style, because the speed the code executes you may be opening folders that dont yet exist.

You will need the FSO functions like CreateFolder, CreateTextFile.

You could also get away without using adox if you use the getrows() method of the ADO recordset - it gets the data & column names into an array and is much better preformance for large data sets.


ar=MyRecordset.GetRows();
nRecordCount=ArrayLen(ar[1]);
arColNames=ArrayNew(1);
for (field in MyRecordset.Fields) {
ArrayAppend(arColNames, field.Name);
};

Source:http://dbforums.com/arch/210/2003/8/877151

pageoneresults

2:10 pm on Jan 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Have you thought about using a URI rewrite routine? There should be no need to create any static pages. You will need to create the templates and the index pages to back them up. I have a couple of sites that function like this. We are able to create pages on the fly based on the requested URI.

Welcome to WebmasterWorld Roosta!

txbakers

4:19 pm on Jan 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hoping not to have to learn too much ASP, can draw on my old C++ days

That's one of the advantages of using ASP.NET - you can write all the functions in C++ without having to really learn a whole new language. Just some ASP specfic commands.