<title> in the body (I know it"s wrong)

<title> in the body (I know it"s wrong)

am 28.07.2007 20:57:34 von Paul Furman

I know it's wrong but it works: putting the in the body of the <br /> document inside another <head> because I'm generating this with php & <br /> kind of boxed myself into not having access to the text I want till I <br /> get well into the body, for example:<br /> http://edgehill.net/gallery/photo-update/6-24-07/pg1pc1<br /> I noticed that duplicate titles have no effect.<br /> <br /> --------------<br /> Also, regarding length, the W3C folks say<br /> http://www.w3.org/Provider/Style/TITLE.html<br /> "Whilst there is no limit on the length of a title (as it may be <br /> automatically generated from other data), information providers are <br /> warned that it may be truncated if long."<br /> <br /> I have no problem with truncating, the alternative would be for me to <br /> truncate it myself. I'm gathering the titles from photo annotations <br /> which are sometimes a long paragraph of text like:<br /> http://edgehill.net/gallery/cameras/pg1pc3<br /> <br /> Mozilla strips this to a about 300 characters:<br /> 1) Gitzo G1298 tripod with Linhoff LN9051 ball head 2) TC-14E AF-S <br /> teleconverter 3) TC-20EII AF-S teleconverter 4) Tokina 300mm f/2.8 MF <br /> (most of that is lens shade & teleconverters 5) MC-20 release 6) 105mm <br /> f/2.8 AF-S VR Micro 7) Nikon D200 8) 135mm f/2<br /> <br /> IE7 strips it to about 100 characters:<br /> 1) Gitzo G1298 tripod with Linhoff LN9051 ball head 2) TC-14E AF-S <br /> teleconverter 3) TC-20EII AF<br /> <br /> -- <br /> Paul Furman Photography<br /> http://edgehill.net<br /> Bay Natives Nursery<br /> http://www.baynatives.com</p> </article> <article> <h2>Re: <title> in the body (I know it"s wrong)</h2><span>am 28.07.2007 23:42:39 von Shion</span> <p>Paul Furman wrote:<br /> > I know it's wrong but it works: putting the <title> in the body of the<br /> > document inside another <head> because I'm generating this with php &<br /> > kind of boxed myself into not having access to the text I want till I<br /> > get well into the body, for example:<br /> > http://edgehill.net/gallery/photo-update/6-24-07/pg1pc1<br /> > I noticed that duplicate titles have no effect.<br /> <br /> The effect depends on the browser, most browsers are made to correct the ill<br /> written code that many WYSIWYG generates and badly written scripts as in your<br /> case.<br /> <br /> You should not echo out everything as soon as you have generated or fetched<br /> the data, you can store things in variables and have the html generation last<br /> <br /> <?PHP<br /> //do here what you need to fetch your data<br /> //and store it into variables like<br /> $mysqli = new mysqli_connect('localhost','root','','database');<br /> $result=$mysqli->query('select title from table where page='{$_GET['page']}');<br /> list($title)=$result->fetch_array();<br /> ?><br /> <html><br /> <title><? $title ?>


Something



> --------------
> 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

Re: <title> in the body (I know it"s wrong)

am 29.07.2007 00:13:04 von cwdjrxyz

On Jul 28, 1:57 pm, Paul Furman wrote:
> I know it's wrong but it works: putting the in the body of the<br /> > document inside another <head> because I'm generating this with php &<br /> > kind of boxed myself into not having access to the text I want till I<br /> > get well into the body, for example:http://edgehill.net/gallery/photo-update/6-24-07/pg1 pc1<br /> > I noticed that duplicate titles have no effect.<br /> ><br /> > --------------<br /> > Also, regarding length, the W3C folks sayhttp://www.w3.org/Provider/Style/TITLE.html<br /> > "Whilst there is no limit on the length of a title (as it may be<br /> > automatically generated from other data), information providers are<br /> > warned that it may be truncated if long."<br /> ><br /> > I have no problem with truncating, the alternative would be for me to<br /> > truncate it myself. I'm gathering the titles from photo annotations<br /> > which are sometimes a long paragraph of text like:http://edgehill.net/gallery/cameras/pg1pc3<br /> ><br /> > Mozilla strips this to a about 300 characters:<br /> > 1) Gitzo G1298 tripod with Linhoff LN9051 ball head 2) TC-14E AF-S<br /> > teleconverter 3) TC-20EII AF-S teleconverter 4) Tokina 300mm f/2.8 MF<br /> > (most of that is lens shade & teleconverters 5) MC-20 release 6) 105mm<br /> > f/2.8 AF-S VR Micro 7) Nikon D200 8) 135mm f/2<br /> ><br /> > IE7 strips it to about 100 characters:<br /> > 1) Gitzo G1298 tripod with Linhoff LN9051 ball head 2) TC-14E AF-S<br /> > teleconverter 3) TC-20EII AF<br /> ><br /> > --<br /> > Paul Furman Photographyhttp://edgehill.net<br /> > Bay Natives Nurseryhttp://www.baynatives.com<br /> <br /> The W3C shows many validation errors, but your page works on 5 common<br /> browsers I have to test. If you end your url with just pg1, pc1, or<br /> just a slash, you get 3 different pages, one being a photo of a bay<br /> area country view. Likewise, using the error <script language =<br /> javascript 1.2> instead of the now required <script ="text/<br /> javascript"> works, despite being an error. The same for several other<br /> errors. The point is that all or some browsers may work for certain<br /> errors. However, with the next version upgrade, the browser may not<br /> work with some errors that it did before. Then the webmaster may have<br /> to hack a way around the problem or correct errors to get a certain<br /> browser to work again. Of course some new browsers have bugs,<br /> especially IE ones, but these usually are detected fairly early and<br /> posts in groups such as this point out the problem and how to get<br /> around it.</p> </article> <article> <h2>Re: <title> in the body (I know it"s wrong)</h2><span>am 29.07.2007 02:25:00 von Adrienne Boswell</span> <p>Gazing into my crystal ball I observed Paul Furman <paul-@-edgehill.net> <br /> writing in news:ykMqi.29886$2v1.842@newssvr14.news.prodigy.net:<br /> <br /> > I know it's wrong but it works: putting the <title> in the body of the <br /> > document inside another <head> because I'm generating this with php & <br /> > kind of boxed myself into not having access to the text I want till I <br /> > get well into the body, for example:<br /> > http://edgehill.net/gallery/photo-update/6-24-07/pg1pc1<br /> > <br /> <br /> Better to put all your logic at the beginning of your script. Close <br /> connections as soon as possible. It's also easier for you, as a <br /> developer, to put that stuff at the top, easier to find and debug. I <br /> write mostly ASP, but the same is true for any language, eg:<br /> <br /> <% option explicit%><br /> <!--#include file="connectionstring_inc.asp"--><br /> <% 'declare variables<br /> 'open recordsets, get info and put it into arrays<br /> 'close recordsets<br /> %><br /> <!--#include file="linkrel_inc.asp"--><br /> <% 'above file includes the Doctype, html and head elements, stylesheet, <br /> favicon, title, and meta information<br /> %><br /> </head><br /> <body><br /> ....<br /> <!--#include footer_inc.asp"--><br /> <% 'above closes db connection, end body and html %><br /> <br /> <br /> -- <br /> Adrienne Boswell at Home<br /> Arbpen Web Site Design Services<br /> http://www.cavalcade-of-coding.info<br /> Please respond to the group so others can share</p> </article> <article> <h2>Re: <title> in the body (I know it"s wrong)</h2><span>am 29.07.2007 03:20:55 von Paul Furman</span> <p>cwdjrxyz wrote:<br /> <br /> > On Jul 28, 1:57 pm, Paul Furman <pa...@-edgehill.net> wrote:<br /> > <br /> >>I know it's wrong but it works: putting the <title> in the body of the<br /> >>document inside another <head> because I'm generating this with php &<br /> >>kind of boxed myself into not having access to the text I want till I<br /> >>get well into the body, for example:<br /> http://edgehill.net/gallery/photo-update/6-24-07/pg1pc1<br /> > <br /> > The W3C shows many validation errors,<br /> <br /> Oh yeah, I'm sure. I haven't tried validating for quite a while, my bad, <br /> though some of those are intentional errors like this one designed for a <br /> specific effect.<br /> <br /> > If you end your url with just pg1, pc1, or<br /> > just a slash, you get 3 different pages, one being a photo of a bay<br /> > area country view.<br /> <br /> original:<br /> http://edgehill.net/gallery/cameras/pg1pc3<br /> <br /> These should all take you to the first pic on the page:<br /> http://edgehill.net/gallery/cameras/pg1 (page#)<br /> http://edgehill.net/gallery/cameras/<br /> http://edgehill.net/gallery/cameras<br /> <br /> This produces an error, it's not designed to work:<br /> http://edgehill.net/gallery/cameras/pc3 (pic# with no page)<br /> (I could fix it with some more php coding & save another 2 characters in <br /> the url but oh well, if someone gets creative they can't be too <br /> surprised to get an error)<br /> <br /> This is a weird way to show the wrong page of thumbnails:<br /> http://edgehill.net/gallery/cameras/pg2pc3<br /> (the displayed pic is on the previous page) LOL<br /> <br /> <br /> <br /> > The point is that all or some browsers may work for certain<br /> > errors. However, with the next version upgrade, the browser may not<br /> > work with some errors that it did before. Then the webmaster may have<br /> > to hack a way around the problem or correct errors to get a certain<br /> > browser to work again.<br /> <br /> Thanks, good point, that's why I asked. In an ideal world I can fix this <br /> as J.O. suggested by doing all my processing before writing the html in <br /> php but it's a huge nighmare of include files & lotsa work to fix at <br /> this point.<br /> <br /> -- <br /> Paul Furman Photography<br /> http://edgehill.net<br /> Bay Natives Nursery<br /> http://www.baynatives.com</p> </article> <article> <h2>Re: <title> in the body (I know it"s wrong)</h2><span>am 29.07.2007 03:26:20 von Paul Furman</span> <p>Adrienne Boswell wrote:<br /> <br /> > Gazing into my crystal ball I observed Paul Furman <paul-@-edgehill.net> <br /> > writing in news:ykMqi.29886$2v1.842@newssvr14.news.prodigy.net:<br /> > <br /> >>I know it's wrong but it works: putting the <title> in the body of the <br /> >>document inside another <head> because I'm generating this with php & <br /> >>kind of boxed myself into not having access to the text I want till I <br /> >>get well into the body, for example:<br /> >>http://edgehill.net/gallery/photo-update/6-24-07/pg1pc1<br /> > <br /> > Better to put all your logic at the beginning of your script. <br /> <br /> Yes, that's my problem. I'm not sure it's easier to debug though, that <br /> approach puts the html miles away from the relevant code so it's far <br /> from easy (to me anyways). But yeah I did it wrong. I did do it right in <br /> some portions of the code.<br /> <br /> > Close connections as soon as possible. <br /> <br /> No databse in this site believe it or not, it's all just nested folders <br /> with content & little .txt files for annotations & shortcuts! I believe <br /> it is rather hard on the poor server.<br /> <br /> > It's also easier for you, as a <br /> > developer, to put that stuff at the top, easier to find and debug. I <br /> > write mostly ASP, but the same is true for any language, eg:<br /> > <br /> > <% option explicit%><br /> > <!--#include file="connectionstring_inc.asp"--><br /> > <% 'declare variables<br /> > 'open recordsets, get info and put it into arrays<br /> > 'close recordsets<br /> > %><br /> > <!--#include file="linkrel_inc.asp"--><br /> > <% 'above file includes the Doctype, html and head elements, stylesheet, <br /> > favicon, title, and meta information<br /> > %><br /> > </head><br /> > <body><br /> > ...<br /> > <!--#include footer_inc.asp"--><br /> > <% 'above closes db connection, end body and html %><br /> > <br /> > <br /> <br /> <br /> -- <br /> Paul Furman Photography<br /> http://edgehill.net<br /> Bay Natives Nursery<br /> http://www.baynatives.com</p> </article> <article> <h2>Re: <title> in the body (I know it"s wrong)</h2><span>am 29.07.2007 05:58:07 von Paul Furman</span> <p>cwdjrxyz wrote:<br /> <br /> > If you end your url with ...just a slash, you get different..<br /> <br /> OK thanks, I did see that on another page though not these ones, more to <br /> look into thanks again.<br /> <br /> -- <br /> Paul Furman Photography<br /> http://edgehill.net<br /> Bay Natives Nursery<br /> http://www.baynatives.com</p> </article> <article> <h2>Re: <title> in the body (I know it"s wrong)</h2><span>am 30.07.2007 15:13:02 von Toby A Inkster</span> <p>Paul Furman wrote:<br /> <br /> > I know it's wrong but it works: putting the <title> in the body of the <br /> > document inside another <head> because I'm generating this with php & <br /> > kind of boxed myself into not having access to the text I want till I <br /> > get well into the body<br /> <br /> <?php<br /> <br /> // I don't know the title yet, so I'll turn on output buffering and<br /> // then output an empty title.<br /> ob_start();<br /> print "<html>\n";<br /> print "<head>\n";<br /> print "<title>\n";
print "\n";

// OK. Now I know what the title is, so switch off output buffering
// and replace the empty title with the known title.
$title = 'Lalala';
print str_replace('',
"$title",
ob_get_clean());

?>

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 39 days, 16:46.]

demiblog 0.2.2 Released
http://tobyinkster.co.uk/blog/2007/07/29/demiblog-0.2.2/