Howdy, Stranger!

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

Sign In with Google Sign In with OpenID

pass controller params when redirecting?

edited May 2014 in Apps

I have an app called stores. I would like the individual store pages to have URLs like http://my.domain/store/id, even though the 'correct' URL would be http://my.domain/stores/store/id. I created a root-level page '/store' and added a dynamic object redirect to '/stores/store'. However, the trailing parameter 'id' is not passed by the redirect. Is there a better way to set this up?


  • You can pass on parameters to "mirror" a handler like this:

    <?php // apps/store/handlers/index.php
    echo $this->run ('stores/store/' . join ('/', $this->params));
  • I don't quite understand. If I want /stores to be an index page but /store/id to be a detail page, would the method you suggest work?

  • edited June 2014

    If you want to keep the actual handler for /store/id in the stores app, then you would create 3 handlers:

    1. apps/stores/handlers/index.php handles the /stores index page
    2. apps/stores/handlers/store.php handles the detail pages
    3. apps/store/handlers/index.php contains just the line from my example, which passes requests to /store/id on to the real detail handler.

    Let me know if that makes more sense.

  • Ah, I missed the fact that you put store instead of stores. D'oh!

Sign In or Register to comment.