Thought of that too - having done that several times.
Departing from the theoretical and exposing my actual code -- the
system is a job tracking and management tool, with the base data in a
table named 'jobs'. The model is job.php and the controller is
jobs_controller.php. It all works fine under /cake12/jobs/ with or
without specific routing.
I want to use two different URLs to access different 'instances' of
the application - using different database tables. The two paths I
want to use are '/cake12/jobtrack' and '/cake12/biotrack'. I have the
database and configuration working fine for the first call to the app.
The index page works just as I would expect.
If I try to access the URL (say '/cake12/jobtrack' ) with no router
settings, I get Error: JobtrackController could not be found - exactly
what I would expect.
If I add Router::connect('/jobtrack', array('controller' => 'jobs',
'action' => 'index')) to the router file, I can connect to the index
page, but any subsequent pages, such as '/cake12/jobtrack/add', I get
the no controller error again - which makes perfect sense.
If I add Router::connect('/jobtrack/*', array('controller' => 'jobs'))
- the additional address works, but seems to always go to the index
page.
Here is the code from the router file:
Router::connect('/', array('controller' => 'pages', 'action'
=> 'display', 'home'));
Router::connect('/pages/*', array('controller' => 'pages',
'action' => 'display'));
Router::connect('/jobtrack/*', array('controller' => 'jobs'));
Here is a parameter dump from the first line of beforefilter in the
controller:
1. accessed as /cake12/jobs/add
app/controllers/jobs_controller.php (line 15)
Array
(
[pass] => Array
(
)
[named] => Array
(
)
[controller] => jobs
[action] => add
[plugin] =>
[form] => Array
(
)
[url] => Array
(
[url] => jobs/add
)
[bare] => 0
[webservices] =>
)
2. Accessed as /cake12/jobtrack/add
app/controllers/jobs_controller.php (line 15)
Array
(
[pass] => Array
(
[0] => add
)
[named] => Array
(
)
[plugin] =>
[controller] => jobs
[action] => index
[form] => Array
(
)
[url] => Array
(
[url] => jobtrack/add
)
[bare] => 0
[webservices] =>
)
So where does it get the action=index from?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---