D
D
Dmitry S2014-01-09 18:53:29
Kohana
Dmitry S, 2014-01-09 18:53:29

How to work with GET parameters passed in the address bar in Kohan?

Tell me, please, who came across how to work with GET parameters passed in the address bar in Kohan? For example, when requesting the form test.eg/index/test?a=1&b=2 in $_GET I get:
array(1) { ["test/index"]=> string(0) "" }
The output is not quite as expected. Getting the parameters a and b is possible only by parsing the contents of $_SERVER['REQUEST_URI'], but this solution is more like a crutch. I want something native to Kohana.
Interested in queries like ".../?a=1&b=2". Kochanian routes completely ignore everything after the "?" in the address bar.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
W
WebSpider, 2014-01-09
@Hakkunamatata

99% that the problem is not in Kohan. I work a lot with Kohana and never had such problems. Try like this
If it prints NULL, then the problem is definitely not in Kohan

A
Alexey Shavrak, 2014-01-11
@alekseyshavrak

It all depends on how the parameters in the route are called. default id
$this->request->param('id');

E
Evgeny Kalibrov, 2015-02-12
@Dima_kras

You can check "userAgent" at the web server level and do a redirect. You can check the window resolution on the client or the same userAgent. On the server it is preferable to do this, of course. What web server do you have?
Example for apache, in .htaccess:

RewriteEngine on
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml¦application/vnd.wap.xhtml+xml" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|benq|blac|blaz|brew|cell|cldc|cmd-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "dang|doco|erics|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windowssce|iemobile|mini|mmp" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|android|mobile|pda|psp" [NC]
RewriteRule ^(.*)$ http://m.имя_сайта.ru/$1 [NC,L]

V
Vitaly, 2015-02-12
@rim89

PHP library - Mobile-Detect

M
mobileman, 2015-03-04
@mobilman

You still have to write a script using cookies that will allow you to use the main version on tablets, since Android tablets are indistinguishable from smartphones.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question