|
Posted by jukka on 01/12/06 18:53
Andrew wrote:
> Hi Jukka,
> if I'm following this correctly, hardwarereviewsdisplay.php
> contains the following code at the top:
>
> <?php
> $file = 'hardware/'; //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);
> ?>
>
> <html>
> <head>
> </head>
>
> <?php
> print "<title>$title</title>"; //print intel670processor.htm's title in
>
> hardwarereviewsdisplay.php
> <?php
>
> Which would read the <TITLE> tag from intel670process.htm?
>
> cheers,
> Andrew
>
http://pastebin.com/502569
something like that. Just make sure the path to the file is correct. Eg.
If hardwaredisplay is in directory /www/public/ and the file in
/www/public/hardware/intel.htm then the path would be hardware/inte.htm
which you have in you ?page= url variable.
BTW, I looked into regular expression and it is much easier to get the
title using preg match: http://fi.php.net/preg_match
the pattern would be something like: '/<title>(.*)<\/title>/'. So if you
want to look into that. But it should work the longer way too ;)
Good luck
Navigation:
[Reply to this message]
|