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

PHP Server Side Scripting Forum

Dynamic Webpage Titles for multiple pages
How do I make each page unique?

5+ Year Member

Msg#: 3470472 posted 12:47 am on Oct 6, 2007 (gmt 0)


I have hundreds of "search result" pages on my site that I have mod-rewrited into Google-friendly urls. Nice.

However, each page is titled in a very generic way:

eg. Cookies Page 1, Cookies Page 2, Cookies Page 3, etc.

As I can't really grab keywords from the page content (they are just random results), I want to be able to pull a selection of keywords from a seperate file and print them as a permanent Title on each page:

eg. Cookies Page 1 --> Jam Cookies, Choc Cookies, Yummy Cookies
eg. Cookies Page 2 --> Yummy Cookies, Yellow Cookies, Choc Cookies
eg. Cookies Page 3 --> Jam Cookies, Yummy Cookies, Yellow Cookies

These titles would be taken dynamically and randomally from a list of titles included from somewhere for each page, but they are permenant for each page (they don't change after a page refresh so that Google sees them the same way each time it slurps).

Does anyone know some code or a script somewhere that could easily setup a batch of titles and have the page generator grab a title for each Cookie Page?

I know this doesn't make sense but hopefully someone sees my vision.




WebmasterWorld Senior Member 5+ Year Member

Msg#: 3470472 posted 5:56 am on Oct 9, 2007 (gmt 0)

On one side you want to select title randomly and at the same time you want to attach specific titles for specific pages.

It might be very hard unless you write your own code.

there could be different ways to handle this. for example if these pages are generated from google search results you can grab the SEARCH QUERY / STRING and make that title of your page it will be very relevant.

otherwise write a function which parse the body of the page and then make its title by grabbing words from <h1></h1> tags in your page. That will be very good for google too. Because your aim is just not to select titles but titles which matches your page's body. Only then you will get some score from SEs.

If you stores these results in some database then it is very easy. Add a column of TITLE in your table and each time you store a page's body store its title too. Then read it from table and make the title


5+ Year Member

Msg#: 3470472 posted 10:24 am on Oct 9, 2007 (gmt 0)

Thanks for your reply, I'll certainly look into your points.

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