|
-
Aug 26th, 2007, 04:16 AM
#1
Thread Starter
Lively Member
[Resolved]Getting <title> to use in HTML file,
Hello all,
Another small question! This time it might be difficult to explain but I'll try my best and ask question when you have any.
I want to get the HTML <title> value from a variable called &file,
Example:
The title of the current page is "Home"
I want to get title of File.php which is "Not Home" and show it in the content on home.php somewhere(By example via an Echo)
File.php gets included in the main content screen using a PHP Include.
I hope this makes it clear what I want to do and that I can get some help
Thank already!
Last edited by Neo-dark; Aug 29th, 2007 at 06:00 AM.
Reason: Resolved
i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD
Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis
-
Aug 26th, 2007, 06:37 PM
#2
Re: Getting <title> to use in HTML file,
declare it as a variable.
$title = "Home";
echo $title;
My usual boring signature: Something
-
Aug 27th, 2007, 03:35 AM
#3
Thread Starter
Lively Member
Re: Getting <title> to use in HTML file,
That would mean declaring it in each file, Which might not be possible
i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD
Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis
-
Aug 27th, 2007, 11:52 AM
#4
Re: Getting <title> to use in HTML file,
well if you have a main include file (say 'settings.php') all you need to do is include that on the top of every page.
and inside of settings.php have $title = "Home";
and on each page have echo $title;
My usual boring signature: Something
-
Aug 27th, 2007, 12:15 PM
#5
Re: Getting <title> to use in HTML file,
PHP Code:
<?
$filename = "index.php";
$fhnd = fopen($filename, "r");
$fstr = fread($fhnd, filesize($filename));
fclose($fhnd);
$fstrA = split("<title>", $fstr);
$fstrB = split("</title>", $fstrA[1]);
$fstr = $fstrB[0];
echo $fstr;
?>
This should do the trick.
EDIT:
Tested it and made a slight change.
Works for me now.
Last edited by TheBigB; Aug 27th, 2007 at 12:20 PM.
Delete it. They just clutter threads anyway.
-
Aug 29th, 2007, 05:59 AM
#6
Thread Starter
Lively Member
Re: Getting <title> to use in HTML file,
 Originally Posted by TheBigB
PHP Code:
<?
$filename = "index.php";
$fhnd = fopen($filename, "r");
$fstr = fread($fhnd, filesize($filename));
fclose($fhnd);
$fstrA = split("<title>", $fstr);
$fstrB = split("</title>", $fstrA[1]);
$fstr = $fstrB[0];
echo $fstr;
?>
This should do the trick.
EDIT:
Tested it and made a slight change.
Works for me now.
And it does the trick wonderfully,Thank you.
i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD
Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|