Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Request / Solved] Changing title later in HTML  (Read 2892 times)

0 Members and 1 Guest are viewing this topic.

Ben

[Request / Solved] Changing title later in HTML
« on: May 03, 2006, 06:13:06 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
Is it possible to change what the title is later in the HTML?
My code currently doesn't check what the page it's loading is until it loads the content, at which time it requests the title, and I want it to set it there.
Is there like a PHP header that would do it?
« Last Edit: February 24, 2012, 05:33:50 pm by Niek »
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion
Re: Changing title later in HTML
« Reply #1 on: May 03, 2006, 08:22:24 pm »
  • Minalien
  • *
  • Reputation: +10/-1
  • Offline Offline
  • Gender: Female
  • Posts: 2119
You can do this with Javascript, I'm not sure exactly what to use, but you can find it somewhere... Just google for Javascript, you'll eventually find the information you need
Logged
Quote
There's such a double standard about religion in the modern world. Catholics can gather, wear white robes, and say "In nomine Patris, et Filii, et Spiritus Sancti" and be considered normal.

But if my friends and I gather, wear black robes, and say  "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn", we're considered cultists.
  • Development Blog

Dayjo

shut the fuck up donny.
Re: Changing title later in HTML
« Reply #2 on: May 03, 2006, 10:13:57 pm »
  • hungry..
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3602
if you're using php surely you can just do summat like

Code: [Select]
<title><? echo $titlevar; ?></title>
Unless I'm missing something here?
Logged
  • My Blog

Naz

Re: Changing title later in HTML
« Reply #3 on: May 04, 2006, 01:26:43 am »
  • Ph34r the toast.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 374
He means after you are alread  ing the <body> tag, you set the title.  I don't think you can do it without JS, redoing some of the php, or using invalid XHTML/HTML. :/
Logged
Don't read this.

Dayjo

shut the fuck up donny.
Re: Changing title later in HTML
« Reply #4 on: May 04, 2006, 10:24:33 am »
  • hungry..
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3602
Oh right, well then you can just do like;

<a href="#" onclick="document.title='pies!';">CLICKY HERE[/url]

Surely?
or like make a function and put it on the <body onload=""> event.

Logged
  • My Blog
Re: Changing title later in HTML
« Reply #5 on: May 04, 2006, 12:21:11 pm »
  • Minalien
  • *
  • Reputation: +10/-1
  • Offline Offline
  • Gender: Female
  • Posts: 2119
<a href="#" onclick="document.title='pies!';">CLICKY HERE[/url]
Ah, yes, that's it. I was trying to think of the JS function, but I haven't used JS in years <.<

Just put
Code: [Select]
onload="document.title='titlehere';"
in your <body> tag (ie <body onload="document.title='titlehere';">)
Logged
Quote
There's such a double standard about religion in the modern world. Catholics can gather, wear white robes, and say "In nomine Patris, et Filii, et Spiritus Sancti" and be considered normal.

But if my friends and I gather, wear black robes, and say  "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn", we're considered cultists.
  • Development Blog

Ben

Re: Changing title later in HTML
« Reply #6 on: May 04, 2006, 05:32:09 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
That again defeats the point, because If I know it there I'll know it in the head :S...
Well if I just put a script in the HTML it should work.
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion
Re: Changing title later in HTML
« Reply #7 on: May 04, 2006, 05:36:06 pm »
  • Minalien
  • *
  • Reputation: +10/-1
  • Offline Offline
  • Gender: Female
  • Posts: 2119
Well where are you getting the information from? A MySQL database? Or if you're getting it from a form, there's a way in Javascript to get that (fornmane.elementid.value I think). The point is that you have to have SOMEWHERE you're getting the title from, so when you get that information, use the document.title='titlehere'; command in Javascript
Logged
Quote
There's such a double standard about religion in the modern world. Catholics can gather, wear white robes, and say "In nomine Patris, et Filii, et Spiritus Sancti" and be considered normal.

But if my friends and I gather, wear black robes, and say  "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn", we're considered cultists.
  • Development Blog

Dayjo

shut the fuck up donny.
Re: Changing title later in HTML
« Reply #8 on: May 04, 2006, 06:29:44 pm »
  • hungry..
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3602
Well where are you getting the information from?
Ditto.
I'm confused.

Perhaps it's in the sub content pages? If so just have the script in the content page.
Logged
  • My Blog

Ben

Re: Changing title later in HTML
« Reply #9 on: May 04, 2006, 06:31:39 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
....
The content is called and figured out when it comes to the content table. Which is within the body....
And so I decided I could just change the title then in a script...

Yey for trailing off...

Oh and FIX'D.
« Last Edit: May 04, 2006, 06:36:36 pm by Ben »
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.043 seconds with 57 queries.

anything