Re: How to pull existing Title tag into the body of the document as text only

From: Joseph Ellis (jandellis_at_cox.net)
Date: 08/05/04


Date: Wed, 04 Aug 2004 19:55:37 -0500

On 4 Aug 2004 14:59:57 -0700, cargears@gmail.com (Cargear) wrote:

>I need to be able to pull the current <Title> tag from the header into
>the body of the html page. We started coding this with php, and we
>were able to get it working. However the entire page is being parsed
>and really bogging down the system and the pages load very slowly.
>(the system is Dual P4 2.4, 1GB ram, Redhat 9.0)
>To fix this we decided to just use javascript, which worked great.
>Text loaded immediately. However, search engines will not process the
>javascript, thus this text will not be available in the document to be
>scanned.
>Does anyone have a way to pull a title tag from a document and display
>its content as text only within a document, Without loading down the
>system? When we tried it, it took the pages at least 5 times longer to
>load than without the code.
>
>Any feedback at all would be greatly appreciated. Thanks very much.

One thought that comes to mind, assuming that the pages you're talking
about have static, predefined titles, and also assuming that you're
wanting to use PHP, would be something like:

<html>
<head>
<?php $title="Whatever you want the title to be"; ?>
<title><?php echo $title; ?></title>
<!-- other head content -->
</head>
<body>
<!-- blah blah blah -->
<p>The title of this page is <?php echo $title; ?></p>
<!-- blah blah blah -->
</body>
</html>

I don't imagine that would create too much work for your server, but I
don't know what your situation is.

Take care,
Joseph



Relevant Pages

  • Attempt to de-mystify AJAX
    ... A javaScript enabled web browser. ... One of the first things to happen is toward the last in the html code: ... Set the onReadyStateChange handler to our processChange() function ... I like PHP so our example uses php. ...
    (comp.databases.pick)
  • Simple Javascript replace (with a twist!) of an href
    ... know this isn't that hard, i'm just a little new to javascript, and I ... so I need to change the href of a link on our php driven auction ... The reason I need to do this is that the html parser used by our ... I have spent hours searching and testing with no luck. ...
    (comp.lang.javascript)
  • Re: Doing a Text comparison
    ... So if a job description has (PHP, JSP, ColdFusion, HTML, Javascript) ... Or someone puts ColdFusion in the description and in the resume there ...
    (comp.lang.java.help)
  • Re: Lost formatting in browser view source
    ... At the same time your html pages without php-code are processed by php. ... If you are concerned about users links and bookmarks to break, you have the nice option in apache to rewrite rules, if they try to load a "missing" html page, redirect them to a php file with the same name. ... run your editor, load 100 pages, use find/replace to change the address ...
    (alt.php)
  • Re: Buffering HTML page
    ... javascript (in the middle frame) load the page in the lower frame (and ... The javascript then, immediately, ... :: a 3ed party design tool from Acrobat and stored as HTML. ...
    (microsoft.public.inetserver.iis)