Jump to content

Header Question


TheMovieman

Recommended Posts

Ok, so even though in the past this code has worked for my header, for some reason it's not working now. Here is the code I have:

 

><?php

if ($type == movie) {
echo "<TITLE>Movieman's Guide to the Movies >> Review Index >> Movies</TITLE>";
}

if ($type == dvd) {
echo "<TITLE>Movieman's Guide to the Movies >> Review Index >> DVDs</TITLE>";
}

if ($type == hidef) {
echo "<TITLE>Movieman's Guide to the Movies >> Review Index >> Hi-Def Titles</TITLE>";
}

?>

 

I have one for the 3 different review indexes on my site:

http://www.moviemansguide.com/reviewindex.php?type=dvd

http://www.moviemansguide.com/reviewindex.php?type=hidef

http://www.moviemansguide.com/reviewindex.php?type=movie

 

And even though each one will grab the correct info, the header is not working anymore. Any ideas of why?

Link to comment
Share on other sites

You don't appear to have any quotation marks around the 'dvd', 'hidef' and 'movie'.

 

Why not do something like this instead:

 

 

>
switch ($type)
{
case 'dvd':
	$title = 'DVDs';
	break;
case 'hidef':
	$title = 'Hi-Def Titles';
	break;
case 'movie':
default:
	$title = 'Movies';
	break;
}
echo '<TITLE>Movieman's Guide to the Movies >> Review Index >> '. $title.'</TITLE>';

Link to comment
Share on other sites

How recently has it broken?

 

How are you assigning the $type variable? Are you doing something like $type = $_GET['type']; or are you relying on register_globals to assign the variable automatically?

 

If the latter, then it could be to do with register_globals being disabled on your account. If this is the case then I advise you to run through your existing code and ensure you are not relying on automatic variable creation via register_globals anywhere and you are manually assigning them yourself.

 

I could be way off with the register_globals guess, not even sure TCH have it enabled on any of the linux boxes anyway, but it is one explanation.

 

 

Edit: you will have to escape the apostrophe in "Movieman's" in the title in the code I wrote. Like this:

 

>
echo '<TITLE>Movieman\'s Guide to the Movies >> Review Index >> '.$title.'</TITLE>';

 

Sorry about that

Edited by OJB
Link to comment
Share on other sites

Ah, I recently had TCH disable register_globals due to a potential security issue with an Coppermine (I think that's it) image gallery (it gave me a warning). I checked my other pages and those are fine. But I am assigning the type variable, yes.

 

Anyway, when I get a chance, I will try out the code. Thanks for your help. :)

Edited by TheMovieman
Link to comment
Share on other sites

You said before you ARE assigning the variable didn't you?

 

Just in case you aren't, try this in your header:

 

 

>
$type = $_GET['type'];
switch ($type)
{
       case 'dvd':
               $title = 'DVDs';
               break;
       case 'hidef':
               $title = 'Hi-Def Titles';
               break;
       case 'movie':
       default:
               $title = 'Movies';
               break;
}
echo '<title>Movieman\'s Guide to the Movies >> Review Index >> '. $title.'</title>';

 

If this is what you are doing, feel free to PM me some of the code and I will have a look through it for you and see if I can figure out what is going wrong.

Edited by OJB
Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...