I want to make a directory of all the photo galleries in my website (individual pages) and display their ID number and page title on the directory page. I plan to use a loop to create the sequential ID numbers, retrieve the page titles of the URL provided with the ID added at the end (ie: album_id=203), then display both. Can someone please help me with this?
Does the gallery content change so often that you must do it dynamically rather than keeping a static list of the titles and their IDs?
If you do it dynamically, you'll need to guard against malicious remote file inclusion, in the code that processes incoming requests for the gallery pages.
The page titles are between <title> and </title> tags in the source code. You'll need to open the files and use regular expressions to extract what's between those tags in each page.
Assuming the IDs match the filenames, you can get a list of them by getting a directory listing. If you generate the IDs in a loop, you'll just need to check to see if each possible numeric ID matches an existing file; if it does, open it and get the <title> contents.
I don't have to keep it dynamic, but there's already so much content created that it'll take too much time to manually create a directory, so I was hoping this script could do the work for me.
However, I ran the idea by my boss and he said that the last time a robot (which this is essentially) tried to index all our galleries it screwed up the system and skewed the site statistics, so I've pretty much been told to abandon this plan. Thanks for the help though!
Ok. I interpreted your inquiry as being about a dynamic page that builds the index page each time a visitor requests it, which seemed like a lot of potentially unnecessary server overhead.
If a static index page is acceptable, then you can probably create some automated methods similar to what I described, that will help create ID/title pairs which you can then put on a static index page for use on the live site. I.e. you would run that program only once to help you build the static page, then upload the page you created to the server.