Hello All, I have a fledgling website, and I would like to conform its two halves. The first half is an honest to goodness website, and the second half is a pretty well organized directory of non-html (but text) content. So far, I've been visiting each directory, taking the html that apache makes, and saving the unique bits into list.html. Then, I copy a generic index.shtml into the same directory. The desired net effect is consistent styles and headers across both halves (I also change the generic <h1>Index of /...</h1> to something less awkward). My question: Can I simply tell Apache to load a css page into every index it generates? Is there a way to automate the process? If anyone could please help, I would be very grateful. I don't mind visiting 100 directories or so, copy, paste... but if an easy alternative exists then it would be much appreciated. I am somewhat competent at writing a script, but I wouldn't even know whether to start on the client or server side. Thanks A Million, Scott PS: Live links and Signatures are not available to me yet. Otherwise, I would hand out my URL.
Well... do you have ssh access to the server where your account is hosted? If you do, then here is an easy way. Step 1. Take your CSS code, and paste it into one file, for example style.css and put it in your main html folder. Step 2. Login to ssh, go in your main html folder, and execute this code (replace yoururl.com with your domain name): perl -i -pe 's/<\/head>/<link rel="stylesheet" type="text\/css" href="http:\/\/www.yoururl.com\/style.css" media="screen"><\/head>/g' *.html Code (markup): This will add this line to each of your html files in your main html folder (right before closing </head> tag): <link rel="stylesheet" type="text/css" href="http://www.yoururl.com/style.css" media="screen"> Code (markup): Of course you should replace this yoururl.com with your site address. That's it! It's not that hard eh? Note: For having this same line added to each html file in SUBFOLDERS you should change the last part of that first code *.html to */*.html and so on for subfolders of subfolders */*/*.html etc. Code is simple, so you can change stuff if needed. For example if your files are .htm and not html, then just change *.html to *.htm etc.
pr0t0n: I appreciate your reply. Yes, I do have ssh access to my webserver. If I understand your suggestion, it relies on adding a tag to an existing index.html files in each directory. I should clarify; the index.html files do not exist currently. Only a few directories have actual index files. I made about 2 index.shtml files in the following manner: visit the directory in a web browser, copy the list of hyperlinks into list.html, copy a generic index.shtml file into the directory, and realize that making the other 163 would be far too much effort. Is there anyway to ask apache to walk the directory structure and save the html into an index? Then, I could tweak the commands you so generously offered to make it pretty and navigable. Really, you solved the second half of my problem. Any help on the first half is much appreciated. Thanks, Scott
hmmm that would be easier then if you installed some file manager script that would just read folders and files from the path you specified, and it would look pretty. I believe there are some free php scripts... but since you want to do it this way... 1. Is there any pattern in the names of those folders? It would help a lot if there is... also, do those folders contain any subfolders or just files you want to list? 2. Can you show an example of that list.html after you do the work manually? 3. Can you show an example of that index.shtml file after the work is done manually? Some shell script could do the trick... I don't think there is other way... you can't specify style code via .htaccess or any similar method...
My index.shtml file looks like this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html40/loose.dtd"> <html> <head> <!--#include virtual="/header.html"--> <title>Hello World!</title> <meta> </head> <body> <!--#include file="list.html"--> <!--#include virtual="/directory.html"--> </body> </html> Code (markup): And my list.html looks like this: <h1>Appropriate name</h1> <ul> <li><a href="directoryA/"> Another list</a></li> <li><a href="directoryB/file.ext"> Some file</a></li> <li><a href="directoryC/"> Some other list</a></li> </ul> Code (markup): For those new to the topic. The question is: Can I get Apache to walk directories and save the generated html into a list.html? From there, I could copy a generic index.shtml into each directory and remove the html code outside of the <ul></ul> in list.html This cuts down on resources (except storage, which I can spare) while maintaining styles across the site. To be honest, I just finished doing it all manually. It only took a few hours. It would be nice to have a script execute every day or week and update the list.html files. I thought that there would be a really easy way to make Apache do this: sorta serve the files to memory instead of a client.