homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Retrieve & Display Another Page's Title
Retrieve and display another page's title

5+ Year Member

Msg#: 4023414 posted 10:25 pm on Nov 11, 2009 (gmt 0)

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?



5+ Year Member

Msg#: 4023414 posted 3:48 am on Nov 17, 2009 (gmt 0)

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.


5+ Year Member

Msg#: 4023414 posted 1:07 am on Nov 21, 2009 (gmt 0)

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!


5+ Year Member

Msg#: 4023414 posted 6:02 am on Nov 21, 2009 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved