Forum Moderators: coopster

Message Too Old, No Replies

I'm stuck need some help please

         

jereme_s

4:18 am on Jun 25, 2004 (gmt 0)

10+ Year Member



i'm new to php and just recently went from html to php on the review section of my website the problem i am having is that i am unable to change the page titles when the page is called upon. the main page title exist on every page called.

i would like to be able to fix it where everytime an album is selected on the right and opened the page title is then changed to the name of the album.

[edited by: jatar_k at 4:43 am (utc) on June 25, 2004]
[edit reason] no personal urls thanks [/edit]

Swash

4:33 am on Jun 25, 2004 (gmt 0)

10+ Year Member



easy... have the PHP code above the header of your html, assign a variable called $titleadd and assign it the name of the album. Then in your html put
<title>Yoursite: <?=$titleadd?></title>

jatar_k

3:47 pm on Jun 25, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld jereme_s,

since you are using a GET string to get the data for the content area of the page you have the title already. You just need to have it incorporated into your template. I would also set a default title for a case where there is no album name available.

jereme_s

5:35 am on Jun 26, 2004 (gmt 0)

10+ Year Member



Still can't get it to work i figured this should work but i get an error

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php
if($pageName == "tupacres") {
$titleadd = "2Pac Ressurrection OST";
?>
<html>
<head>
<title>example.com Album Reviews<?=$titleadd?></title>
</head>

if i remove--->
if($pageName == "tupacres") {

then the addtitle works but,it is added to all the page titles?
I think i am assigning the variable wrong. any suggestions?

[edited by: jatar_k at 9:55 pm (utc) on June 26, 2004]
[edit reason] removed specifics [/edit]

jereme_s

5:38 pm on Jun 26, 2004 (gmt 0)

10+ Year Member



baiscally i just need the 2Pac Ressurrection OST title to be only for that album not for every page so i need to know how to assign it to just that album and then add more titles for the rest of the albums.

yowza

7:02 pm on Jun 26, 2004 (gmt 0)

10+ Year Member



I didn't see your website, but you had some errors in the code you submitted. They are fixed below:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php
if($pageName == "tupacres")
$titleadd = "2Pac Ressurrection OST";
?>
<html>
<head>
<title>example.com Album Reviews<? echo $titleadd;?></title>
</head>

[edited by: jatar_k at 9:56 pm (utc) on June 26, 2004]
[edit reason] removed specifics [/edit]

jereme_s

3:45 pm on Jun 27, 2004 (gmt 0)

10+ Year Member



Thank you guys for all of your help especially yowza for correcting my code for me it worked perfectly.