It's okay to be a n00b, Mike, everybody starts off as one. It's a
framework, there's a learning curve. C'est la vie.
Having said that, you are close to the answer. There's two different
ways you could do that. Way One:
Router::connect('/:id',
array('controller' => 'pages', 'action' => 'showLog'),
array('id'=>'[0-9]+', 'pass' => array('id'))
);
- and -
class PagesController extends AppController {
function showLog($id = null) {
// ....
}
}
Way Two:
Router::connect('/:id',
array('controller' => 'pages', 'action' => 'showLog'),
array('id'=>'[0-9]+')
);
- and -
class PagesController extends AppController {
function showLog() {
$id = $this->params['id'];
}
}
Please note that Way One only works in the latest branch code of Cake
1.2, not the beta release.
On Mar 25, 5:14 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I have never in my life had more trouble doing straightforward things
> than I have in the last month with CakePHP. Online articles, the
> manual, the API, and the 1.2 book (http://book.cakephp.org/complete/3/
> the-manual)
>
> have led me to try about six ways of setting up a route that:
> takes URLwww.site.com/5
> and goes to
> PagesController->showLog($id)
> with the 5 as the id argument
>
> so this is the last rule in my routes.php
>
> Router::connect('/:id',
> array('controller' => 'pages', 'action' => 'showLog'),
> array('id'=>'[0-9]+')
> );
>
> That syntax is straight out of the "You'll be a routing pro" section
> of the book. It feels like I'm telling it to use the controller and
> action I specified, and put the data (5) into $id
>
> but i get
> Warning (2): Missing argument 1 for PagesController::showLog() [APP/
> controllers/pages_controller.php, line 17]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---