Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Php Auto Website Title
Prophet.K
post 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 .. tongue.gif

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
}
Go to the top of the page
 
+Quote Post
bluechip
post 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?
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. The Most Annoying Website(47)
  2. The Best And Free Website/html Editors + Text Editors(44)
  3. Give Me Website Ideas..(26)
  4. Making A DSL Connection Auto-Connect On StartUp(5)
  5. Excellent Free Website Templates(15)
  6. Grand Theft Auto San Andreas Online Multiplayer Mode(3)
  7. Innovative Login System(15)
  8. Runescape 2 Website(41)
  9. Free Music Video Clips To View And To Download(2)
  10. Free Domain Website(13)
  11. Review My Website(4)
  12. Make You Own Website Toolbar ^^/(1)
  13. Website Still Down.(4)
  14. Free Web Hosting: (the Need For Speed) [denied](1)
  15. Free Web Hosting: (engrjayze) [screened] [approved](2)
  1. Free Web Hosting: (the Need For Speed) [screened] [approved](2)
  2. How To Make A Website ?(5)
  3. Free Web Hosting: (chriso_cd) [approved](1)
  4. Free Web Hosting: (cgeniusgo) [denied](1)
  5. Free Web Hosting: (csshih) [screened] [approved](2)
  6. Website Drop Shadow Effect Help(7)
  7. Updating Website, Ftp Problems(5)
  8. Free Web Hosting: (shane Sonnier) [screened] [approved](2)
  9. Free Web Hosting: (abdurahmanl) [screened] [approved](3)
  10. Best Html Webdesign Studio(2)
  11. Free Web Hosting: (guiphp) [denied](1)
  12. Free Web Hosting: (erdemir) [screened] [approved](2)
  13. Free Web Hosting: (thecolorchangingfedora) [approved](1)


 



- Lo-Fi Version Time is now: 16th May 2008 - 12:57 PM