Forum Moderators: coopster
For example: index.html?section=widgets&sub=blue
If there is no "sub" variable, the title is "My Site - Widgets". If the sub variable is there, I check it against a list of possible sub-titles: ["Blue Widgets", "Red Widgets"] and just append it: "My Site - Widgets - Blue Widgets"
It's not pretty, but I'm much happier having page titles, especially since I have heard it can improve search engine rankings.
Finder's idea is a very nice one, hadn't thought of it. I, personally, would write them all by hand and then store them in a db and then call the proper one for the proper page using an include.
Seems to work well in the search engines most of the time :)
The number is the primary id for the page, providing title,meta description, page title etc.
IMHO its "lazy" in the fact the titles can be hard coded in certain pages, but for a situation like a "web directory" the dynamic creation of titles if pretty cool, i.e. for > breadcrumb > navigation
I used this a lot, also append it to the end of the meta description.
It is good if you notice a trend in the log files you can update the pages content very quickly i.e xmas/christmas :)
Do you think having H1 & title that match exactly is asking for trouble?
If the title is hard coded within the body element (though I know of no sensible reason why it should be there) then you could postprocess your output by using output buffering and registering a call back function when starting output buffering [php.net]. A better solution would be to change all your documents. That way the server would not have to do the same work over and over again for each request.
If the title is not hard coded within the body element but the code to get it is currently within your include file that produces the body tag then you should move the code so that it gets executed right at the start of your script as rogerd suggested. c3oc3oīs suggestion is one way to get the title to appear in your first include after the code changes.
If you are willing to share what you do not understand about this approach then I am most certain that somebody here will gladly help you. Just saying I didnt understand sounds more like "I donīt like the advise and canīt be bothered to think about its merits."
Andreas
I've never had any trouble before (touching wood now), however, I do concatenate the company name to the title, which makes it a little harder to identify automatically.
For example:
<title>$headline - $companyname</title>
<h1>$headline</h1>
For some of my sites the abstract of the page is also in the database, which makes creating the description tag very easy.
<title>$headline - $companyname</title>
<meta name="description" content="$abstract">
<h1>$headline</h1>
<h2>$abstract</h2>
Leaves with me with training the data entry guys to create keyword rich headlines and abstracts....but thats not as easy as it sounds ;)
<added>paff3, is there anything in your database you can use as a title? otherwise it seems you are left with hardcoding them, or trying to harvest that information from your pages with a view to insert them into the database </added>