Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to create a page and make a url link to it
  • i have a code here:
    case self::M_TENANT_EXPORT:
                            $this->history_forward('m_tenant/export');
    in that function it will call Response::redirect($url);

    but im still confused how to make a page in fuelphp and link it to that url
  • it is inside a module by the way
  • HarroHarro
    Accepted Answer
    FuelPHP uses a mechanism called URI segment routing.

    It means that it will look at the segments of the URI (the path of the requested URL), and will map that to a controller action method.

    If for example your URL is http://example.org/try/this/out/please, the framework will look for:
    - a controller called Controller_This_Out in the module "try", with a method called "action_please"
    - a controller called Controller_This in the module "try", with a method called "action_out"
    - a controller called Controller_This_Out_Please in the module "try", with a method called "action_index"
    - a controller called Controller_Try_This_Out in the application, with a method called "action_please"
    - a controller called Controller_Try_This in the application, with a method called "action_out"
    - a controller called Controller_Try_This_Out_Please in the module "try", with a method called "action_index"

    This is the default behaviour, and can be altered by defining routes, which can map the URI segments to another controller.

    Once the controller method is located, it is called, and the rest is up to you as a developer. If you're using a standard controller (extends \Controller), your method should return either a Response object with the response you want to send back to the browser, a View object, or a Theme object. If your controller extends Controller_Template, your method should assign data to the defined template, the returned output will be created automatically by the framework.

    As for files on disk, the structure maps to the class name (and the other way around).

    So, if you have a controller in app/classes/controller/try/this.php, it must contain a class called Controller_Try_This. If this then contains a method called "action_out", you can call this method using the URL "http://example.org/try/this/out".
  • Info - 2013-05-10 18:53:01 --> Fuel\Core\Request::__construct - company_id:1 user:root --> Creating a new Request with URI = "t_tenants_history"
    Info - 2013-05-10 18:53:01 --> company_id:1 user:root --> C:\xampp\htdocs\pit\fuel00\fuel\app\modules\t_tenants_history\
    Info - 2013-05-10 18:53:01 --> company_id:1 user:root --> t_tenants_history
    Info - 2013-05-10 18:53:01 --> Fuel\Core\Request::execute - company_id:1 user:root --> Called
    Info - 2013-05-10 18:53:01 --> Fuel\Core\Request::execute - company_id:1 user:root --> Setting main Request
    Info - 2013-05-10 18:53:01 --> Controller_Pit_Hybrid->before - company_id:1 user:root --> controller->T_tenants_history\Controller_Search action->index start
    Debug - 2013-05-10 18:53:01 --> Auth\Auth_Acl_CustomAcl->has_access - company_id:1 user:root --> http://pit.localhost/t_tenants_history method: GET
    Debug - 2013-05-10 18:53:02 --> Auth\Auth_Acl_CustomAcl->has_access - company_id:1 user:root --> 該当URIが存在しません URI:http://pit.localhost/t_tenants_history




    here is what in the log displays..it did find the module but still got the error
  • What error? You haven't mentioned any error?

    You said you were confused to how it worked?
  • yeah i was confused how it worked then i was able to realize that it is redirecting to a module then that is the error.....sorry for that, that should be on my other question, i forgot....

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion