Welcome Guest, Not a member yet? Register   Sign In
why can't I send a uri segment to my index function ??
#1

[eluser]seanloving[/eluser]
I wish this was possible but I get Page Not Found whenever I try to request a URL such as site.com/page/somepage

Code:
class Page extends Controller {

    function Page()
    {
        parent::Controller();
    }

    function index( $pagerequest )
    {
        // do stuff
    }
}


Where do I dig to figure out why this won't work?

Thanks

--Sean Loving
#2

[eluser]joeizang[/eluser]
dude,

from your link example and sample controller, you must have a function called somepage for it to be available in your url. the function should call a view if you so desire or you can use a template depending on prefrence
#3

[eluser]seanloving[/eluser]
[quote author="joeizang" date="1254629856"]dude,

from your link example and sample controller, you must have a function called somepage for it to be available in your url. the function should call a view if you so desire or you can use a template depending on prefrence[/quote]

I understand and use the standard convention, but I'm trying to make this work:

If there are no other methods in the Page class then I want the last segment (e.g. 'somepage') to be used as the $pagerequest parameter of the index function. My goal is to manually route an incoming $pagerequest whose name is arbitrary and thus not necessarily known by my Page controller a priori.

Basically I'll call the view within where I say // do stuff

-SL
#4

[eluser]Colin Williams[/eluser]
Use a _remap() method in your controller. Check the Controller page in the User Guide for details
#5

[eluser]seanloving[/eluser]
Thanks Colin - that's what I was looking for.




Theme © iAndrew 2016 - Forum software by © MyBB