# Display content depanding on url

**URL:** <https://www.ruby-forum.com/t/display-content-depanding-on-url/171178>\
**Category:** Ruby\
**Created:** [June 27, 2009, 7:54pm UTC](https://www.ruby-forum.com/t/display-content-depanding-on-url/171178 "2009-06-27T19:54:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![henster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a183cd/32.png) [@henster](https://www.ruby-forum.com/u/henster)\
**Post date:** [June 27, 2009, 7:54pm UTC](https://www.ruby-forum.com/t/display-content-depanding-on-url/171178/1 "2009-06-27T19:54:18Z")

</div>

Hi,

I am sorry if this question has been answered before but I am unable to  
find the answer.

What I would like to do is display the content of a page depending in  
the url, for example

[Whatever.UK](http://whatever.co.uk/package?chosen=something) would display:  
content one  
[Whatever.UK](http://whatever.co.uk/package?chosen=somethingelse) would display:  
content two

I know how to do this in php but the template that I am using is written  
in ruby.

Please could someone help.

---

<div class="post-metadata">

**Author:** ![henster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a183cd/32.png) [@henster](https://www.ruby-forum.com/u/henster)\
**Post date:** [June 27, 2009, 8:14pm UTC](https://www.ruby-forum.com/t/display-content-depanding-on-url/171178/2 "2009-06-27T20:14:42Z")

</div>

On Sat, Jun 27, 2009 at 6:54 PM, Henry T.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

> [http://whatever.co.uk/package?chosen=somethingelse](http://whatever.co.uk/package?chosen=somethingelse) would display:  
> content two
> 
> I know how to do this in php but the template that I am using is written  
> in ruby.

You’re going to have to provide some more context. Are you using rails  
or  
some other web framework?

---

<div class="post-metadata">

**Author:** ![henster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a183cd/32.png) [@henster](https://www.ruby-forum.com/u/henster)\
**Post date:** [June 27, 2009, 10:13pm UTC](https://www.ruby-forum.com/t/display-content-depanding-on-url/171178/3 "2009-06-27T22:13:03Z")

</div>

I asked the company which language the template is written in and the  
tech support guy said:  
“I believe it is written in ruby on the rails”

---

<div class="post-metadata">

**Author:** ![henster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a183cd/32.png) [@henster](https://www.ruby-forum.com/u/henster)\
**Post date:** [July 27, 2009, 8:00pm UTC](https://www.ruby-forum.com/t/display-content-depanding-on-url/171178/4 "2009-07-27T20:00:57Z")

</div>

On Jun 27, 1:54 pm, Henry T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> content two
> 
> I know how to do this in php but the template that I am using is written  
> in ruby.
> 
> ## Please could someone help.
> 
> Posted viahttp://www.ruby-forum.com/.

So, how do you do this in PHP? I am trying to do this in php.

---

<div class="post-metadata">

**Author:** ![henster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a183cd/32.png) [@henster](https://www.ruby-forum.com/u/henster)\
**Post date:** [July 28, 2009, 1:08am UTC](https://www.ruby-forum.com/t/display-content-depanding-on-url/171178/5 "2009-07-28T01:08:59Z")

</div>

Michael Warnick wrote:

> On Jun 27, 1:54ï¿½pm, Henry T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > content two
> > 
> > I know how to do this in php but the template that I am using is written  
> > in ruby.
> > 
> > ## Please could someone help.
> > 
> > Posted viahttp://www.ruby-forum.com/.
> 
> So, how do you do this in PHP? I am trying to do this in php.

if ($url== “[http://whatever.co.uk/package?chosen=something](http://whatever.co.uk/package?chosen=something)”)  
{  
echo “

hello
”;  
}  
elseif ($url== “[http://whatever.co.uk/package?chosen=something](http://whatever.co.uk/package?chosen=something)”)  
}  
echo “
goodbye
”;  
}

---

<div class="post-metadata">

**Author:** ![henster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a183cd/32.png) [@henster](https://www.ruby-forum.com/u/henster)\
**Post date:** [July 28, 2009, 1:23am UTC](https://www.ruby-forum.com/t/display-content-depanding-on-url/171178/6 "2009-07-28T01:23:33Z")

</div>

Henry T. wrote:

> I asked the company which language the template is written in and the  
> tech support guy said:  
> “I believe it is written in ruby on the rails”

The language is ruby. ruby on rails is a piece of software written in  
ruby.

---

<div class="post-metadata">

**Author:** ![henster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a183cd/32.png) [@henster](https://www.ruby-forum.com/u/henster)\
**Post date:** [August 4, 2009, 3:20pm UTC](https://www.ruby-forum.com/t/display-content-depanding-on-url/171178/7 "2009-08-04T15:20:41Z")

</div>

Michael Warnick wrote:

> On Jun 27, 1:54ï¿½pm, Henry T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > content two
> > 
> > I know how to do this in php but the template that I am using is written  
> > in ruby.
> > 
> > ## Please could someone help.
> > 
> > Posted viahttp://www.ruby-forum.com/.
> 
> So, how do you do this in PHP? I am trying to do this in php.

This is how I do it in PHP

if (isset($\_GET[‘chosen’]) && ($\_GET[‘chosen’] == ‘something’)) {  
echo “Hi”;  
}  
if (isset($\_GET[‘chosen’]) && ($\_GET[‘chosen’] == ‘somethingelse’)) {  
echo “There”;  
}

I still have no idea how to do it with Ruby
