May 17, 2008

Php Auto Website Title

Free Web Hosting, No Ads > CONTRIBUTE > The Internet > Web Design

free web hosting

Php Auto Website Title

Prophet.K
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
}

 

 

 


Reply

bluechip
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?

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : php auto website title

  1. Excellent Free Website Templates - (15)
    Site also includes 60 free logo templates, 63 free banner templates, 84 free newsletter templates,
    website arrows, abstract images, and much more. Fantastic resource...
    http://www.templatesbox.com/templates.htm ...
  2. Need A Logo For Website Can't Get Into Ideas - (10)
    Hi friends i'm running site on computinghost server called http://onecore.net i think again i
    need some help,for good touch to the site so pleasse help me can you think of any good logo idea,i
    want simple,creative,techno-anime style yet smoot for eyes. can you think of any good idea,mymind
    is just wandering here and there /unsure.gif" style="vertical-align:middle" emoid=":unsure:"
    border="0" alt="unsure.gif" /> hope u understand that .... Please send in any dieas for logo almost
    anything....
  3. How To Make A Website - (If you're trying to drive people away from your site) (16)
    Alright so there are many topics out there of how to make a website that everyone will love and want
    to go to, but I can't seem to find any about how to make a website that people will hate and try
    to run away from, so here are some pointers for those who are trying to make the worst website:
    Step one: COLORS Be sure to use a vivid and bright background color, and a non-noticeable text
    color. Nothing wakes people wake up more than a florescent yellow background with white text. Make
    people work to try to read your website. After all, you have some great content...
  4. Help Creating A Profile Website - how do i make a profile website (12)
    Ok this is my idea: I am making a website about anime. Its function is add anime, review anime,
    search anime, anime information. Users can make a profile. People can make a profile which they can
    edit to theire likes with html to give it a fancy look.(this is what my problem is about) What i
    would like to know is how can i accomplish this. I already have the database for the anime titles
    etc ready, the only thing that needs to be done is the profile section. If you have any tutorial,
    tip or guide i would really really appriciate it. Thx in advance. ...
  5. How To Build A Good Website - (2)
  6. Image Not Taking The Right Size In Web Page - An image is correct when designed, but not when put in a website (1)
    When trying to make a web page with a GIF image on it which runs a coloured bar along the top and a
    coloured curve along the side, I come across the weird thing that, when I put the image on a web
    site, it does not take in the whole top and does not run from top to bottom completely. The image is
    made in Adobe Photoshop at a resolution of 1024X768 pixela and looks correct , ie. the horizontal
    bit runs completely from left to righ and the vertical bit completely from topright to bottom right,
    yet when put in to the web page, it shows with big margins left and right and to...
  7. Xml For Dynamic Website Content - (3)
    Anyone got a site where they're using XML to generate dynamic content? I'm thinking of
    using XML for several elements of the website for my workplace, partially because I can easily
    generate XML through a simple VBA interface far easier than XHTML (since I'm only considering
    the content), so that I can set up easy ways of changing that content for the completely computer
    illiterate people I work with. Also, I'm doing an XML course later, so I want ot get some
    practice in /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif...
  8. Man Why Is Everything Hard To Get A Website Design - man webdesigning is hard (32)
    okay ppl why is that they give u front pagew that u make a webdisgn adnthe u have to bye better
    stuff just to get it right plz tell me why...
  9. Help! Php Or Just Html? - i want to start buliding my website. which is better, php or basic htm (6)
    i try to start this topic in webhost category but it seems like i cant. i dont have the permission
    so i just post my topic here. im sorry mod.. i want to build a website which contains: - Links to
    videos - Informations - photos - flash i don't know if i should use php or just HTML. guys,
    what are your opinions..??...
  10. My Website Design , Any Suggestions? - this is something i designed with the help from user sonesay , what do (13)
    Hey guys I designed and almost finish my site, www.keegonguyen.com .. so what do you guys think?
    Have any good suggestions? or anything that i should take out? anything good or bad about it?
    anything at all that would help me out would be nice /tongue.gif" style="vertical-align:middle"
    emoid=":P" border="0" alt="tongue.gif" /> Is it too plain? any beneficial criticism will be fine
    /rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" />
    let me know thanks /smile.gif" style="vertical-align:middle" emoid=":)" border="0" ...
  11. Webdesign Frequently Askd Questions - is it posible to design a sercheingin in your website. (4)
    what i wanna no is is it posible to incorporate a custom search engin into your own website. for a
    while now i have bin wondering is it posible to do this as i would like to try something like this
    out. but i have heard of there being a way to do this in pearl but i no nothing of pearl does
    annyone have anny tips or info on this? (i use frontpage and dreamweaver)...
  12. Please Rate My Website - out of a possible 10 (19)
    I have built a newly designed website here with Trap17 - http://www.zofanatic.com . Can you please
    rate it or give me some suggestions on the design and layout (including the forum, which runs on
    SMF). Thanks...
  13. Is There An Xbox Live Gamertag Code To Shw The Gamercard On A Website? - The title says all! (1)
    Hi everyone, im looking for a code that will display a users xbox live gamercard. Ive seen one
    little widget but that was for the igoogle page ao its not suitable for what i want. Ideally I want
    one thats written with HTML or something like that so its easy for me to modify and such. What i
    want it to do is t have a URL in the code which the user can then insert their gamertag ID into and
    have the widget display their gamercard for all to see. if i ever use this code it will be on a
    money making site, hopefully, so something thats free to use even for commercial things ...
  14. How To Create Smallest Website - (17)
    I wonder if any one create smallest website on earth? any webmaster can share this things .. .if
    they can make how could it be? /wink.gif" style="vertical-align:middle" emoid=";)" border="0"
    alt="wink.gif" />...
  15. What Are The Steps To Making A Website? - (10)
    what are some steps to making a website? im doing a project and i need like 5-7, but id ont know
    waht to put. ...
  16. Need Environmental Website Ideas! - Needing Environmental website ideas for design! (0)
    Hi everyone, I am new to trap17.com. In fact this is my first message. So... Yeah! for me. I
    hope this will website will live up to all of the hype that I have been hearing from all of my
    friends. Ok well getting on to the subject. I am creating an environmental website for a
    competition. The topic is the environment. I can do absolutely anything about the environment. My
    idea is to create a website that will show all of the facts about both the good and bad of the
    environment and all that we can do to help/ save the environment. I am looking for some amaz...
  17. Php Scripts And Website Templates - php scripts and website templates (1)
    I need some help. I´m trying to start my own website but I´m out of ideas about the design... The
    site should look something like this (click to view) Like I said I´m out of ideas so if any of you
    knows of a good and free web template that looks like my site please post the link to it. I´m also
    looking for some free php scripts (classified ads, fotolog, youtube, banner exchange, link exchange,
    adbux) so if you know where I can find any of those scripts please let me know. Thanks in advance.
    "I Need Some Help" isn't a good topic title. Changed to a more descript...
  18. Help Needed For Alumni Website. - (6)
    I'm planning to start an Alumni website for my college mates, I searched for any Alumni CMS but
    couldn't find one. So If anyone of you know any Alumni or Community CMS, please share it with
    me. I need a community CMS where each member Can have his own page, and somewhat related to orkut.
    If there is any add-on MODs for Joomla or Mambo please do share them too....
  19. How To Beat Ironport(best Website Blocker?) - proxy browsing (0)
    I am asking this question to all experts And answer is not that simple. Problem is that all the
    proxy sites are also banned by IRONPORT. So u cannot beat it that easily. The only solution i know
    is to find out a newest proxy site before it is banned? Is there any better way? All TECH-GODS...
  20. Which Is The Best Premade Website? - mambo or phpnuke (7)
    Hi, I am looking for a ready made site like mambo or phpuke, anyone know anyhting faster and lighter
    to use. Moving from What Is...? to Webdesigning Tools and Software Discussion . Topic title AND
    its description are very important when posting a new topic. Entered description. ...
  21. How Do I Put A Flash Image In My Website - (10)
    oke i got flash now and i made this button http://www.crazydesign.trap17.com/coolflashthingy.swf
    this button i wanne use for my website now my question is, what do i need to put it online do i need
    a special code or something,i'm not experienced with this,i heard something about a special code
    u need for it,but i dunno wichi'm just used to using tis QUOTE ...
  22. How Successful Are Part-time Website Designers/developers? - (10)
    I have been createing websites for a while now. I use HTML, Javascript, just added PHP, and starting
    MySQL. I'm thinking about trying to start createing website partime. Any of you guys ever tryed
    it? If so how well did it go and how should I start?...
  23. Website Creation Suggestions - (12)
    I'm currently trying to create a website for myself.. But I don't know what to add to the
    site.. I need suggestions from people who have created their sites.. I've added a tag board by
    the way.. What else can I add... ?...
  24. New Horse Website - (1)
    So I designed this horse website for my parents and was wondering if there was anything else I can
    do to make it better (besides adding more pictures: most of the pics are fillers at this point).
    Let me know if you have any suggestions!!! Oh and here is the site link below:
    http://web.mac.com/alpinemisthorsefarm Thanks for the help!...
  25. Preview Your Website In Ie From Non-windows Os - (9)
    If you are using a non-windows based OS probably Linux or Mac OS may be even Solaris or OS/2, you
    can preview how you website or new site design looks in Internet Explorer. A site by Daniel Vine
    provides you this facility for free, Just head over to http://www.danvine.com/iecapture/ and
    enter your sites URL to preview. This site will automatically create a screen shot of your site how
    it appears in IE. Usually it will take longer to get a screenshot because always there will be
    thousands of such sites queued to be previewed. Post your comments and experiences....
  26. Website Template! - I need a website template! (8)
    Ok here's the thing i'm new to making a website like this and i need a website template that
    is html! If anyone finds some please tell me thanks! /biggrin.gif"
    style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />...
  27. Free Phpnuke Themes - Cool-looking themes for your website (3)
    Hi, i'm new and I would like to start to post in these forums by sharing you all a link to a
    website that contains FREE PHP-Nuke PRO themes. Many of those templates include its own V2 ShoutBox,
    a Flash Navigation Bar, Flash Headers, Forums matching skin and many other cool features. You can
    even play your music in your website with some of them!! Check them out! them are
    perfect for host a gaming website or personal homepages http://phpthemes.net/ ...
  28. Xboxmodz - My New Website (1)
    I have made this new website for modding purposes. I have an ok home page with forums so far. Right
    now i am working on another home page. This will be uploaded as soon as i am done. So give me some
    feedback on both the site and the forums. When being a guest you can only see a few select forums
    like the Site Announcements, XboxModz Staff, Site Feedback etc. Basically whatever is in the
    Category XboxModz Main. EDIT: Ya, sorry. Having one of those days i guess. lol. Here you go.
    www.xboxmodz.trap17.com...
  29. General Categories On Nice Website - Contribute - I'm trying to figure out general categories for personal website (0)
    Hello to all surfers.. Surfing a lot? Tired of messed up links, with strange names and organization.
    You think you could categorize internet in few simple categories made for you by you, which others
    might find attractive?! Well help, and contribute. Maybe if we post how would we like our
    categories to look like going to "BASIS" programmers might follow and we could surf even more
    easier. Post your opinions and ideas. From my side of view, and by the content i look most of the
    time, i would categorize nice site in this categories: QUOTE(My MAIN Categories selectio...
  30. A Quick Guide To Creating A 'blog' Website - I use the term 'blog' in the loosest sense of the word (1)
    Hello all, first post here, nice idea you've got going with the whole credit thing /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> So i thought i'd do my
    bit and write up a quick tutorial on what i've found with my time on the net. Before we start,
    i'd just like to say that when i say 'blog', dont think of a site where all you can do
    is type up your life. No. What I mean is intergrating a program into your site that allows you to
    post news with ease while still still being able to keep the site open to other t...



Looking for php, auto, website, title

Searching Video's for php, auto, website, title
Excellent
Free Website
Templates
Need A Logo
For Website
Can't
Get Into
Ideas
How To Make
A Website
(If
you're
trying to
drive people
away from
your site)
Help
Creating A
Profile
Website how
do i make a
profile
website
How To Build
A Good
Website
Image Not
Taking The
Right Size
In Web Page
An image is
correct when
designed,
but not when
put in a
website
Xml For
Dynamic
Website
Content
Man Why Is
Everything
Hard To Get
A Website
Design man
webdesigning
is hard
Help!
Php Or Just
Html? i want
to start
buliding my
website.
which is
better, php
or basic htm
My Website
Design , Any
Suggestions?
this is
something i
designed
with the
help from
user sonesay
, what do
Webdesign
Frequently
Askd
Questions is
it posible
to design a
sercheingin
in your
website.
Please Rate
My Website
out of a
possible 10
Is There An
Xbox Live
Gamertag
Code To Shw
The
Gamercard On
A Website?
The title
says
all!
How To
Create
Smallest
Website
What Are The
Steps To
Making A
Website?
Need
Environmenta
l Website
Ideas!
Needing
Environmenta
l website
ideas for
design!
Php Scripts
And Website
Templates
php scripts
and website
templates
Help Needed
For Alumni
Website.
How To Beat
Ironport(bes
t Website
Blocker?)
proxy
browsing
Which Is The
Best Premade
Website?
mambo or
phpnuke
How Do I Put
A Flash
Image In My
Website
How
Successful
Are
Part-time
Website
Designers/de
velopers?
Website
Creation
Suggestions
New Horse
Website
Preview Your
Website In
Ie From
Non-windows
Os
Website
Template!
; I need a
website
template!
;
Free Phpnuke
Themes
Cool-looking
themes for
your website
Xboxmodz My
New Website
General
Categories
On Nice
Website -
Contribute
I'm
trying to
figure out
general
categories
for personal
website
A Quick
Guide To
Creating A
'blog
9; Website I
use the term
'blog
9; in the
loosest
sense of the
word
advertisement



Php Auto Website Title



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE