Questions tagged [yii-routing]

Routing in Yii Framework's MVC implementation. Yii is a free, open source PHP web application framework, and it is released under the New BSD License.

yii-routing is a tag suitable for any questions regarding routing in Yii's MVC implementation, url handling, or any other matter affecting or affected by routing in Yii.

43 questions
9
votes
7 answers

How to Set Base URL in Yii Framework

When I do print_r(Yii::app()->request->baseUrl) I get an empty string. A post on the Yii forum says this is blank by default. How can I change its default value so that I can use absolute URLs?
David Xia
  • 5,075
  • 7
  • 35
  • 52
6
votes
2 answers

How to use the Yii2 GroupUrlRule() class

I want to group paths under one common path. I found in the Yii2 documentation that this can be achieved with the GroupUrlRule() class. I can not understand where to set it. I tried to sat it as a rule to the urlManager in confing/web.php but…
bozhidarc
  • 834
  • 1
  • 11
  • 25
3
votes
1 answer

URL routing rules in Yii2

Coming from background of Laravel and Rails I am finding quite a difficulty to figure out how Yii2 rules work. I am looking for following URL patterns: /articles/ /articles/view/ /articles/1/my-pretty-article ArticlesController is defined…
Volatil3
  • 14,253
  • 38
  • 134
  • 263
3
votes
2 answers

Error message in view file

I'm new in Yii Framework. I want to check user exists or not with ajax. view file

İstifadəçi adı
Mirjalal
  • 1,292
  • 1
  • 17
  • 40
2
votes
2 answers

complex htaccess redirection for php/yii application

i want this URL: http://m.mysite.com/XYZ12 to redirect here: http://m.mysite.com/index.php?r=myBook/mobile&oid=XYZ12 Note: XYZ12 will be a dynamic string
2
votes
3 answers

Yii, createUrl not working as expected

I'm doing the following in a view:
  • '>sources
  • However 'sources' is not appended to the path, instead the code just returns the path to the current controller. Could anyone…
    rix
    • 10,104
    • 14
    • 65
    • 92
    1
    vote
    2 answers

    Error in Gii Code Generator Page

    Im trying to access my Yii code generator which is Gii. but when i browse it using http://localhost/mysite/gii/index/ the page says Error 404 Unable to resolve the request "gii/index". this is my .htaccess file for url-rewriting Options…
    Netorica
    • 18,523
    • 17
    • 73
    • 108
    1
    vote
    2 answers

    Yii Framework - URL Manager and Rules for routing

    I have these default route rules in my urlManager in Yii framework: 'urlManager'=>array( 'urlFormat'=>'path', 'showScriptName'=>false, 'rules'=>array( '/'=>'/view', …
    metaforce
    • 1,337
    • 5
    • 17
    • 26
    1
    vote
    2 answers

    How can I pass parameter/dropdown value to model function

    I am using yii2 advanced template improved Not sure if relevant to problem/a solution but to get to the category I have a form with some javascript which on change redirects the user to the category selected. I have the following code which allows…
    con322
    • 1,119
    • 7
    • 16
    • 29
    1
    vote
    1 answer

    yii extensions: how to access controller which is located inside extension

    I am trying to write a custom extension for yii framework and I cannot access controller which is stored in extensions/controllers folder. I have searched a lot but I did not find any hint for that. This is the structure protected --…
    johannesMatevosyan
    • 1,974
    • 2
    • 30
    • 40
    1
    vote
    1 answer

    Yii, custom UrlManager::createUrl() crash the widget-create-link

    I have create a custom UrlManager for adding language parameter at the beginning of the $route. what it do is make $route="site/index" ---> $route="en/site/index" (or other current using language) It is working, but I there is some page I don't…
    Zitty Yam
    • 135
    • 1
    • 12
    1
    vote
    1 answer

    Yii Not able to route requests to different paths

    I have a problem while routing my requests in Yii. Following is the urlManager rules: 'rules'=>array( array('api/index', 'pattern'=>'api///*', 'verb'=>'GET'), array('api/shortlist',…
    Shubham
    • 97
    • 1
    • 14
    1
    vote
    1 answer

    YII URL how to generate new URL

    I have one site in which I want URL like SiteURL/about.html. I have changed code in config/main.php but when I login to site then gets session expired when I navigate to any other page. If comment this code 'showScriptName'=>false in config/main.php…
    Amrish
    • 31
    • 4
    1
    vote
    1 answer

    yii2 'route requested' is empty in debugger

    Trying out Yii2 using the basic app example, and having some trouble with routing. I have a simple login form, and when submitted the correct controller action is called but the $_POST data is empty. In the Yii debugger, everything looks OK in the…
    trad
    • 7,581
    • 4
    • 20
    • 17
    1
    vote
    1 answer

    Yii createUrl for multilanguage website with slug urls

    I've followed this guide for creating SEO-conform Multilanguage urls, now I need to fit url rules for a few modules using slug urls. Used rule is working fine for reading urls, i.e. writing the url like www.mywebsite.com/en/pages/hello-world (it…
    coddoc
    • 65
    • 1
    • 8
    1
    2 3