Reply to Re: Dynamic <title> in PHP?

Your name:

Reply:


Posted by jukka on 01/07/06 14:42

Andrew wrote:
> I'm trying to show the <TITLE> display in hardwarereviewsdisplay.php?
> Can this be done without a database?

Aha, yes :) I've done this myself when I was experimenting with a
flat-file database. Here is what you could do within
hardwarereviewsdisplay.php:

$file = 'path/to/hardware/intel670processor.htm'; //assuming you've
already formatted the page= variable
$handle = fopen($file,"r");
$file_text = fread($handle, filesize($file));
$temp_title = strstr($file_text, "<title>"); //everything from <title>
onwards
$title_end = strpos($temp_title, "</title>");
$title = substr($temp_title, 7, $title_end-7);
fclose($handle);

print "<title>$title</title>"; //print intel670processor.htm's title in
hardwarereviewsdisplay.php

Ok, so I haven't tested this since I just modified another code of mine.
But it should work.
Basically it get's everything from <title> onward in the
intelwhatever.htm file and then it finds out where </title> is and
substrings from after <title> (7 chars) all the way to before </title>.
(I'n other words between <title> and </title>) ;)
Well try it and let us know how it works out.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация