|
|
|
|
![]() ![]() |
May 6 2008, 12:08 AM
Post
#1
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 51 Joined: 24-April 08 Member No.: 61,254 |
This simple PHP function is pretty handy if you want your websites pages in the title without having to name individual ones.
It will look like: QUOTE MyWebsite | Index QUOTE Quote: MyWebsite | Gallery QUOTE Quote: MyWebsite | Forums etc.. paste the code into your "functions" file, or any webpage which is included in every page you have (Reminder: To include a webpage, use 'include("webpage.php");') You can of course put the function in each page, but that's just annoying .. then, in each webpage you want the title to appear, put CODE Code: <?php include("the_function_webpage"); title(); .... ?> I've quoted each line to show the people who don't do PHP, how the function works a little better CODE function title() {
$page = $_SERVER["PHP_SELF"]; // Set variable $page as the current webpage $page = str_replace(".php","",$page); // Remove the .php ending from the string: $page $page = str_replace("/","",$page); // Remove the / before the website name $page = ucwords($page); // Capitalize the first letters echo '<title>MyWebsite | ' .$page. '</title>'; // Change "MyWebsite" to your website name } |
|
|
|
May 7 2008, 05:50 PM
Post
#2
|
|
|
Newbie ![]() Group: Members Posts: 5 Joined: 6-May 08 Member No.: 61,795 |
Very helpful! I think u you shoulda posted it under how-tos. Anyway I thank you for such info.
I wanted to ask if u know how I can inset that small icon that appears in the browser on the address bar. I want my site to display such a thing. Help! Anybody? |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 16th May 2008 - 12:57 PM |