|
Posted by J.O. Aho on 07/28/07 21:42
Paul Furman wrote:
> I know it's wrong but it works: putting the <title> in the body of the
> document inside another <head> because I'm generating this with php &
> kind of boxed myself into not having access to the text I want till I
> get well into the body, for example:
> http://edgehill.net/gallery/photo-update/6-24-07/pg1pc1
> I noticed that duplicate titles have no effect.
The effect depends on the browser, most browsers are made to correct the ill
written code that many WYSIWYG generates and badly written scripts as in your
case.
You should not echo out everything as soon as you have generated or fetched
the data, you can store things in variables and have the html generation last
<?PHP
//do here what you need to fetch your data
//and store it into variables like
$mysqli = new mysqli_connect('localhost','root','','database');
$result=$mysqli->query('select title from table where page='{$_GET['page']}');
list($title)=$result->fetch_array();
?>
<html>
<title><? $title ?></title>
</head>
<body>
Something
</body>
</html>
> --------------
> Also, regarding length, the W3C folks say
> http://www.w3.org/Provider/Style/TITLE.html
> "Whilst there is no limit on the length of a title (as it may be
> automatically generated from other data), information providers are
> warned that it may be truncated if long."
>
> I have no problem with truncating, the alternative would be for me to
> truncate it myself.
It's the browser that may truncate the title if the text is long, how long the
title may be depends on the browser and the size of the window (many browsers
alters the window title to the title).
--
//Aho
[Back to original message]
|