Jump to content


Varying Content


  • You cannot reply to this topic
9 replies to this topic

#1 Dean

    Loves Etomite Forums!

  • Admin
  • 4,758 posts
  • Gender:Male

Posted 06 February 2006 - 05:08 PM

Hi Guys, I need some help - I currently have a snippet:

$location  = $_GET['location'];
if ($location == "") 
{ return "you inputted : nothing"; }
else
{
   $output = 
<<<END
you inputted : {$location}
END;
}
return $output;

What this does is take whatever is after ?location=blah and put the blah bit in my page.

What I want to do is have if the customer puts ?location=hidden then it will show different content based on it, so

if location = hidden then show <b>Hidden Stuff Here</b> else show what was put after the url.

Can you help?

#2 breezer

    Likes Etomite Forums!

  • Member
  • PipPip
  • 308 posts

Posted 06 February 2006 - 05:48 PM

How about this:

$location  = $_GET['location'];
if ($location == "") 
{ 
$output ="you inputted : nothing"; 
}
else
{
  $output = 
<<<END
you inputted : {$location}
END;
}
return $output;


#3 Dean

    Loves Etomite Forums!

  • Admin
  • 4,758 posts
  • Gender:Male

Posted 06 February 2006 - 06:20 PM

Umm, isnt that the same as I posted ? :?

#4 breezer

    Likes Etomite Forums!

  • Member
  • PipPip
  • 308 posts

Posted 06 February 2006 - 06:22 PM

no, I changed the return part in the top section...

#5 breezer

    Likes Etomite Forums!

  • Member
  • PipPip
  • 308 posts

Posted 06 February 2006 - 06:30 PM

I got this one to work...

$location  = $_GET['location'];
if ($location == "") 
{ 
$output ="you inputted : nothing"; 
}
else
{
 $output = 
"you inputted : {$location}";
}
return $output;

I forgot the quotes around the last $output

Edited by breezer, 06 February 2006 - 06:31 PM.


#6 Dean

    Loves Etomite Forums!

  • Admin
  • 4,758 posts
  • Gender:Male

Posted 06 February 2006 - 06:31 PM

This is what I need :

[attachment=989:attachment]

#7 Dean

    Loves Etomite Forums!

  • Admin
  • 4,758 posts
  • Gender:Male

Posted 06 February 2006 - 06:33 PM

At the minute, what I posted is achieves the top two, but not the bottom one

#8 breezer

    Likes Etomite Forums!

  • Member
  • PipPip
  • 308 posts

Posted 06 February 2006 - 06:40 PM

$location  = $_GET['location'];

if ($location == "") { 
$output ="you inputted : nothing"; 
}else if($location =="keyword") {
 $output ="this is the good stuff";
}else{
 $output = "you inputted : {$location}";
}
return $output;


#9 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 06 February 2006 - 06:46 PM

Or, if you have lots of keywords

$location  = $_GET['location'];
switch ($location) { 
case "": $output ="you inputted : nothing"; break;
case "k1":  $output ="text for k1"; break;
case "k2":  $output ="text for k2"; break;
case "k3":  $output ="text for k3"; break;
case "k4":  $output ="text for k4"; break;
case "k5":  $output ="text for k5"; break;
default:      $output = "you inputted : {$location}";
}
return $output;


#10 Dean

    Loves Etomite Forums!

  • Admin
  • 4,758 posts
  • Gender:Male

Posted 06 February 2006 - 06:57 PM

Thanks Everyone!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users