Aug 7, 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

sunshineseeker
QUOTE(bluechip @ May 7 2008, 06:50 PM) *
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?


Always wondered the same thing! Will now do one for site i'm currently building. Not a php thing tho.

http://www.chami.com/tips/Internet/110599I.html

and the same 16x16 icon can be displayed when user bookmarks you page, apparantly wink.gif

http://webdesign.about.com/od/advancedtuto...a/aa070300a.htm

 

 

 


Reply

kobra500
you have to create an Icon "favicon.ico 16px x 16px and upload it somewhere! Try google they will tell you!

Reply

Bayuugan
very interesting thread u have there.
Now i learn 1 new thing in PhP biggrin.gif
THANKS!!!

Reply

bluedragon
thanks.. I was looking for something like this

Reply

gogoily
Thanks, it really helps a lot

Reply

hitmanblood
lol I was usually either writing it to every different page or just using some get variable since sometimes I build sites that are accessible only trough index and then when they in fact click on the link link looks something like this index.php?page=about so it initializes variable page with the name content about and you are able to access any page you wuild with this also variable is accessible trough $_GET['page'] simple as that.

But in the end I must admit your solution is a lot more elegant. However I see that there might be some problems if one page is include in the other one and is also accessible on its self. And one other problem is if you have php files name in different way then the paeg names. Also what happenes when you've got there get variables I think that it gots distorted.

Well these are just thoughts someone might shed some light on it.

best regards

Reply

minimcmonkey
yea, i have used a small icon for favorites menus, you need to create an icon, 16x16 px.
Then you have to upload it somewhere, and in some cases, create a CSS file to tell the browser where to find the file.
I cant remember how to do it exactly, google it, there areseveral tutoials on how to do it...

QUOTE
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:

Recent Queries:-
  1. what is the website title called - 164.56 hr back. (1)
  2. making small icon beside website title - 175.12 hr back. (1)
Similar Topics

Keywords : php, auto, website, title

  1. Build Your Own Asp.net Website Using C# & Vb.net Review
    (0)
  2. Project Euler
    Website(s) with computer programming exercises (1)
    Well, I tried to post this to the Programming Languages subforum, but it seems that I could only do
    so in one of the subforums there... As this is not related to any particular language, I posted it
    here (admins & mods, please feel free to move this to the right section, if this isn't it :))
    So, on we go... Some of you may have already heard about computer programming exercises... Some
    people create exercises and post them on the web, and other people solve them... It's fun, and
    helps you know your math and programming language a lot better... Recently, I found....
  3. Making A Picture Viewer Website
    Html programming or javascript (3)
    this is one thing i've struggled with for ages. I want a webpage where there are little
    thumbnails and in the middle somewhere is the main picture. The littole thumbnails or snipets of
    infor when clicked display the main image corresponding to that clicked thumbnail or link. e.g
    pictures of the country side listed in pairs or 3's or 4's in a column and you click each
    one an the main view on the screen displays that particular picture. How is this achieved. Can any
    one gimme a link to a site with templated for that or javascript for that or html code or past....
  4. Auto-upload Files With Filezilla And Autohotkey
    (0)
    If your web host only allows FTP access and not shell access then you have to edit files locally and
    then upload them. If you are debugging your website that means making a lot of changes to a file or
    files and lots of manual uploads after each change to a file. FileZilla works great to upload and
    download files to a remote FTP site and it even allows you to set a default editor so you can right
    click on a remote file and click view/edit. It then downloads the file to a temporary directory and
    monitors any changes made to the file. When it detects that you have saved the....
  5. Free Web Hosting: (nitish) [screened] [approved]
    Free Website: <nitish.trap17.com> (2)
    To generate an application for free web hosting please click here: Free Web Hosting
    Request Form I would like to request free web hosting from Trap17. Please find my application
    below. Your Registered Domain Name or Desired Trap17 Subdomain Name: nitish.trap17.com
    Account Username: nitish Introduction: I like creating fun electronic circuits,
    playing chess, football  and of course designing and developing website. Email Address:
    nitishweb@hotmail.com Age: 22 Country Where I Live: In....
  6. Free Web Hosting: (klusk) [screened] [approved]
    Free Website: <Rdalvi.trap17.com> (3)
    To generate an application for free web hosting please click here: Free Web Hosting
    Request Form I would like to request free web hosting from Trap17. Please find my application
    below. Your Registered Domain Name or Desired Trap17 Subdomain Name: Rdalvi.trap17.com
    Account Username: strider Introduction: i am doing engg. in comp. science...i
    like the stream i have chosen..mostly the programming stuff... programming languages known :C,
    C++,VB database management : SQL web designing : html & javascript...learning others like....
  7. Postage Costs Problem For My Website
    Ideas for postage system needed (7)
    Hi all, I have a problem with my wife and the postman..........no, I didn't mean to
    say that, I mean I have a problem with how to work out the best way of charging my customers a fair
    postage. Here is the problem; on my website I sell books and our wonderful happy chappies at the
    Royal Mail have decided that not only have we got to weigh the book we now have to measure the
    damned thing as well! This has led to a complete restructuring and complication of the postage
    prices. To make this short I will have to illustrate this the best way I know how....
  8. A List Of Animals And Their Meaning
    Like the title says (1)
    This is a LONG list of animals and their Meanings! ^.^ Hope U like it!

    Alligator - aggression, survival,
    adaptability Ant- team player, worker Armadillo - active, nocturnal, protection Bat - guardian of
    the night, cleaner Bear - power, adaptability Bear Paw - strength, mobility Beaver - builder, gather
    Bobcat - fierce, loner intensity Brontosaurus - harmless giant Buffalo - sacredness....
  9. Which Mail For My Website?
    Which is better yahoomail or hotmail (7)
    Straight to the issue --> My php-mysql website is in final stages and would be replacing my
    current html website anytime soon. I have a contact form which uses send mail. Now I was wondering
    which one is better yahoo or hotmail (gmails is not webmaster friendly. What i like in these two are
    the blocking feature by ip name and domain name (I really want to keep my spam box clean and tidy).
    But Hotmail has this feature "mark it safe" or not. which can accomplish the same task more easily
    when checking mails. The only thing gmail lacks is this, otherwise it is superb. ....
  10. Another Boring New Member Introduction
    the title says it all (6)
    First of all, greetings to anyone who's bored enough to read through these introductions. I
    signed up 2 days ago, got hosted 1 hour ago... And thought it's about time I introduce myself.
    My name is Dan, 24, IT student (hopefully graduating this year). Worked for about 2 years as
    programmer, desktop applications. I love programming when it's not unnecessarily complicated and
    I am kind of a perfectionist. I looked for free webhosting because I want to learn some PHP,
    mostly just for amusement. Also, I want to see how it is to develop and manage an website ....
  11. I Cannot See My Website Or Log Into Cpanel
    (7)
    Ok, I finally got my form approved after that massive wait because of some issue and now, my
    computer decides not to load up my site! - My site does not load up on either browser, I cannot
    ping it (but it resolves the IP) - It loaded ONCE. And never after that - It's not my network, I
    used my neighbors wireless to verify that Can anyone help me? PS. I am samlockart.trap17.com....
  12. Basic Of Website Creation
    Get basic knowledge on website creation here (9)
    By basic, i mean reaaaal "BASIC". I know that its probably redundant info for so many of us, but I
    still would like you to add your bit into this post , so that newbies benefit from it.....
  13. Creating A Good Website, How?!
    (18)
    Creating a good website, How?! I looked at many forums, searching on now to create a good
    website, by good I meant good website interface. For example, Trap17 have this amazing flash header,
    and nice design… I searched and searched, I found that many people started with a photoshop
    picture, then they make it come true by requesting a website coder (A.K.A. Programmer) to code the
    whole website for it. If, I said if, I were good a art, I can design a good nice picture off
    photoshop, and I know how to code, does that means I can make a good website? Please post any ....
  14. I Am Looking Into Going With A Paid Hosting Service And Trap17 Has Been Good To Me So Whats The Paid Hosting's Website?
    (7)
    I am looking at different solutions for paid hosting and I know that that trap17 has some connection
    with a paid hosting company and I would like more info about it because I like the way this place is
    run and it has been a good place to have my website. So what is the site for the paid hosting?....
  15. Build A Website
    (12)
    Anyone know which is the best software to make a website with great features and ease. i want to
    make a cool website so please help me. thanx....
  16. Updating Website, Ftp Problems
    (6)
    2 problems! a) how do i update my website??? like if i make changes to the code of say my
    index.html page, how do i make these changes take place on the website online?? /cool.gif"
    style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif" /> how come my ftp uploads my
    files to a file under my public_html folder but also under a folder with my user name
    (public_html/username ) ??? this makes it so the url of my site isnt www.abc.trap17.com anymore
    but www.abc.trap17.com/username/ ---- this makes no sence!!....
  17. Make A Flat Based Shoutbox, With Auto Refresh.
    (6)
    With this tutorial, you will learn how to create a simple shoutbox, but only uses a .txt file. Also
    with auto refresh, and I am going to do a backgound. We will be making 5 files. 1. index.php The
    main page 2. msg.php Reading msg.txt 3. msg.txt Note: You must give it 777 4. shout.php Where
    it add to msg.txt 5. bg.gif Background. Index.php would be like this: Shoutbox
    Name: Message: Let's go over what the code do. -> are just the title.
    gets msg.php which gets msg.txt. You will know why I do that later. -> is wh....
  18. I Need A Review On My Website
    Review me please (12)
    I need people to review the website i made for my dad. It was my dad's business's website.
    Tell me what you all think about it. Ive only been programming for a year so i think its good for
    only a year, but my opinion doesn't matter. So tell me what ya think. LINK ....
  19. Auto-delete Your Spam In Gmail
    finally, get rid of all that spam! (16)
    i have been using gmail for quite a while, and have always hated hotmail. i hate it now more than
    ever now that it is 'windows live mail'. however, there has always been something about
    gmail that bugs me: how on earth do i get rid of all that spam? i mean, doesn't it ever bug you
    when you have 3 new messages in your inbox, and then 56 bits of spam? and then you have to manually
    head to the spam folder, and delete them all? i know gmail offer you a lot of space and i know the
    spam messages get deleted after 30 days, but for me it is a phsychological thing: i....
  20. Php Scripts And Website Templates
    php scripts and website templates (7)
    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....
  21. Looking For New Mmorpg Relatively Like Runescape
    title says all (12)
    Ok, no spamming me about runescape, it was a fun game in my opinon and i respect others who say to
    it sucks, doesnt suck, just didnt get anywhere...at all, so now i'm looking for something like
    runescape, only relavtively new, I want a game with skills to train, monsters to battle, gold to
    gain, anything of that matter, also, if it could be avioded, i dont wish to download anything, thats
    for looking and/or replying, Peace /laugh.gif" style="vertical-align:middle" emoid=":lol:"
    border="0" alt="laugh.gif" />....
  22. What Are The Steps To Making A Website?
    (17)
    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. ....
  23. Runescape 2 Website
    (56)
    Can someone please give me a link to the runescape 2 website. I want to play runescape 2 but, I
    don't know the website and if you know the runescape 2 website then, please please please tell
    meeeeeeeeeeeeeeeeeeeeee. I tried to find the runescape 2 website everyday but, I didn't. I'm
    still searching for it, No answer yet. -Smartking790- ....
  24. Innovative Login System
    A new way to login to a website (18)
    Hi, I came across this website www.planmylifestyle.com which offers an innovative login system. In
    the traditional login system, a user is asked to enter a username and password besides many other
    personal information. In this website, to register the site creates an ID file that the user can
    download to the local hard drive. After registration, to login to the website, the user has to
    simply upload the registered ID file (browser and select ID file from local hard drive) and click on
    the Login Button. The user is then taken to the website which seems to be a searc....
  25. Read File (.txt) On Another Website Using Jsp?
    (3)
    in my jsp program,i need to read a file (.txt) on another website,how can i do this? thanks a lot.
    shorten title ....
  26. Grand Theft Auto San Andreas Online Multiplayer Mode
    For those who love GTA San Andreas and online games (13)
    Hi, I've been a fan of GTA series, but i always wanted to play those games with other players.
    Well, now thats possible. A while ago i found a mod that makes you play the GTA San Andreas game
    online, and ive been playing it, so now i would like to share it with you all. With this mod you
    can connect to lots of servers, with a big variety of game modes, like DM, TDM, Area 51 break in,
    Money making, and one of the newest ones, League, that is a RPG game mode where you can create an
    account, earn cash, save it to a bank, buy houses and cars, become a police and lots of....
  27. Excellent Free Website Templates
    (18)
    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 ....
  28. How To Lock A Folder And Keep It Private
    title explains it (14)
    okay people i had a member ask earlyer how to lock folder and or a file and i had the answer, and i
    though to my self after i had written it maybe everyone may need to do thsi so ill post it into a
    tutorial, okay so i wrote this for someoneelse earlyer and am posting it here for all to see: you
    dont need software to lock a folder or add a password to a folder right okay this is my little
    tutorial on how to lock a folder, here we go first things first you need a random folder or the
    folder you wish to lcok then put what ever you want to lock into the folder, then right c....
  29. How Long U Play Cod?
    topic title tells all. (18)
    hm... Topic tells all. How long u play call of duty? i have played 2 years!....
  30. The Best And Free Website/html Editors + Text Editors
    A good collection! Check it out. (48)
    Here they are, the best html editors. Just pick one because they are all free, or choose one of the
    ones i most recommend. WebCore Designer 2005 http://www.mpsoftware.dk/webcoredesigner.php
    HTMLGate Free http://www.mpsoftware.dk/htmlgate.php Ma Page Web http://www.aldweb.com
    MAX's HTML Beauty++ 2004 http://www.htmlbeauty.com WebWorks http://w1.213.telia.com
    PageBuilder HTML Editor http://www.tafweb.com Website Mentor http://www.dark-street.com
    Cascade DTP http://www.price-media.demon.co.uk BPlainPro http://home5.swipnet.se/~w-52253/hy....

    1. Looking for php, auto, website, title

Searching Video's for php, auto, website, title
Similar
Build Your
Own Asp.net
Website
Using C#
& Vb.net
Review
Project
Euler -
Website(s)
with
computer
programming
exercises
Making A
Picture
Viewer
Website -
Html
programming
or
javascript
Auto-upload
Files With
Filezilla
And
Autohotkey
Free Web
Hosting:
(nitish)
[screened]
[approved] -
Free
Website:
<nitish.t
rap17.com>
;
Free Web
Hosting:
(klusk)
[screened]
[approved] -
Free
Website:
<Rdalvi.t
rap17.com>
;
Postage
Costs
Problem For
My Website -
Ideas for
postage
system
needed
A List Of
Animals And
Their
Meaning -
Like the
title says
Which Mail
For My
Website? -
Which is
better
yahoomail or
hotmail
Another
Boring New
Member
Introduction
- the title
says it all
I Cannot See
My Website
Or Log Into
Cpanel
Basic Of
Website
Creation -
Get basic
knowledge on
website
creation
here
Creating A
Good
Website,
How?!
I Am Looking
Into Going
With A Paid
Hosting
Service And
Trap17 Has
Been Good To
Me So Whats
The Paid
Hosting'
s Website?
Build A
Website
Updating
Website, Ftp
Problems
Make A Flat
Based
Shoutbox,
With Auto
Refresh.
I Need A
Review On My
Website -
Review me
please
Auto-delete
Your Spam In
Gmail -
finally, get
rid of all
that
spam!
Php Scripts
And Website
Templates -
php scripts
and website
templates
Looking For
New Mmorpg
Relatively
Like
Runescape -
title says
all
What Are The
Steps To
Making A
Website?
Runescape 2
Website
Innovative
Login System
- A new way
to login to
a website
Read File
(.txt) On
Another
Website
Using Jsp?
Grand Theft
Auto San
Andreas
Online
Multiplayer
Mode - For
those who
love GTA San
Andreas and
online games
Excellent
Free Website
Templates
How To Lock
A Folder And
Keep It
Private -
title
explains it
How Long U
Play Cod? -
topic title
tells all.
The Best And
Free
Website/html
Editors +
Text Editors
- A good
collection&#
33; Check it
out.
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