/    Sign up×
Community /Pin to ProfileBookmark

automatic index.html file

Is there a way to have an index file that automatically updates?

I have a directory called photos full of subdirectories of different albums (each containing their own index.html file). I would like the main index.html file to automatically update either daily, or whenever I upload a new album directory.

I would appreciate any advice on this.

-Elaine

to post a comment
HTML

7 Comments(s)

Copy linkTweet thisAlerts:
@pyroMar 14.2004 — Define "update automatically", please.
Copy linkTweet thisAlerts:
@eawalkerauthorMar 14.2004 — Hi,

Thanks for your reply. I realized I should use a cron job to do this "automatically" once a day, so I'm working on that now. Thanks anyway! If anyone is interested, I'll let you know how I end up getting this to work.

-Elaine
Copy linkTweet thisAlerts:
@pyroMar 14.2004 — Sure thing. Good luck. ?
Copy linkTweet thisAlerts:
@eawalkerauthorMar 14.2004 — I made a little cron script called updatephotoindex and put it in my /usr/elaine/bin directory on my NetBSD server:


--------------------
#!/bin/sh

cd /usr/web/ziaspace.com/photos

echo '<br><a href="http://www.ziaspace.com/photos/'ls -t new | tail -n 1'/'ls -t new | tail -n 1'.html">'ls -t new | tail -n 1'</a>' >> index.html



mv new/ls -t new | tail -n 1 .
---------------------





So, I had all of my photo album directories in another directory called 'new'. I started with an index.html file that had only the header. The script takes the newest one and makes a line like:

<br><a href="http://www.ziaspace.com/photos/ALBUM1/ALBUM1.html">ALBUM1</a>



Then moves that directory up one level. I run the script once for each album, and it just keeps adding lines to the index.html file. That's it!



I run the script manually by typing:

'sh updatephotoindex' from within the bin diretory





...in case anyone was interested. ?



cheers,

-Elaine
Copy linkTweet thisAlerts:
@PeOfEoMar 14.2004 — Why wouldn't we just automate this with a server side script and ditch the index.html. Just upload the images to the data base and have the script query it. On your upload page you can have the server create a thumbnail automatically and check the image size etc. That would be easier then trying to parse an html file in my opinion. But this is not a beginners script if you want to write it yourself, dynamic drawing or just an image gallery in general, with asp.net anyway, takes a bit of know how. http://aspnet.4guysfromrolla.com/articles/081303-1.aspx is an article about how to do it with asp.net.
Copy linkTweet thisAlerts:
@eawalkerauthorMar 14.2004 — I'm not parsing any html files for the actual pictures, only for the separate photo album directories within my main directory (I already have an easy way to generate my photo albums). In fact, my question had nothign to do with photos, really, just "how to make an index file get updated automatially with a script, to list all of the directories". You can see for yourself what my script does (just the index file in the photo directory): http://www.ziaspace.com/photos


I appreciate your input. cheers!

-Elaine
Copy linkTweet thisAlerts:
@PeOfEoMar 14.2004 — [i]Originally posted by eawalker [/i]

[B]I'm not parsing any html files for the actual pictures, only for the separate photo album directories within my main directory (I already have an easy way to generate my photo albums). In fact, my question had nothign to do with photos, really, just "how to make an index file get updated automatially with a script, to list all of the directories". You can see for yourself what my script does (just the index file in the photo directory): http://www.ziaspace.com/photos





I appreciate your input. cheers!

-Elaine [/B]
[/QUOTE]
This would mean parsing the index.html if you are using an html file type. If you did it server side it could be automatic with the directories, but then it is no longer html. The server outputs html of course for the server side scripts.
×

Success!

Help @eawalker spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...