Page 1 of 1

How to get the parameter in the URL

Posted: Fri Dec 12, 2008 9:44 am
by mykingla
http://localhost/news/100

How to get the two parameters news and 100 in the url.

I just know only a little.

Can anyone tell the detail process?  :)

Re: How to get the parameter in the URL

Posted: Fri Dec 12, 2008 10:10 am
by Qphoria
$request->gethtml('controller') should be 'news'
$request->gethtml('product_id') should be '100' (might be any id.. category_id, information_id, etc. depending on the page being opened)

you should be able to see what's in the $_REQUEST server variable by using:

in any of the tpl files. Use it at the top of layout.tpl to see what available on certain pages.

Re: How to get the parameter in the URL

Posted: Fri Dec 12, 2008 10:48 am
by mykingla
I always use $url->href to pass the parameter

Re: How to get the parameter in the URL

Posted: Fri Dec 12, 2008 10:55 pm
by mykingla
When I use the gethtml function

Fatal error: Call to undefined method Request::gethtml() in

But if I use $request->get('controller'), that's ok..

Re: How to get the parameter in the URL

Posted: Fri Dec 12, 2008 11:57 pm
by Qphoria
gethtml was added in 0.7.9RC4. if you are using an older version then you need to change it to "get", but be warned that it could lead to display of html tags on descriptions