@José: Here's what i'm using that works on the Contact page where i need to
load the Captchas model to grab a question:
Works:
Plugin::loadAll([
[
'Thook/Websites' => ['routes' => true]
]
]);
Also works:
Plugin::load('Thook/Websites');
Doesn't work:
Plugin::load('Thook/Websites', ['routes' => true]);
Results in ([...] shortening the path to relevant stuff):
*Warning* (2): include([...]/Plugin/Thook\Websites\config\routes.php): failed
to open stream: No such file or directory
[*ROOT\vendor\cakephp\cakephp\src\Core\Plugin.php*, line *346*]
*Warning* (2): include() [function.include]: Failed opening
'[...]/Plugin/Thook\Websites\config\routes.php' for inclusion
(include_path='.;C:\WebServer\php5\pear\pear')
[*ROOT\vendor\cakephp\cakephp\src\Core\Plugin.php*, line *346*]
However, the file path it's trying to include IS valid (aside from
directory separators).
---
@mark
In my primary routes file:
Router::scope('/', function(RouteBuilder $routes) {
// Some routes linking to main App Controllers, working.
// Per your response:
* $routes->connect('/captchas/:action/*', [ 'plugin' =>
'Thook/Websites', 'controller' => 'captchas' // Also tried
'Captchas', but the other routes' controller values are lower-case &
working ]);*
$routes->connect(':controller', ['action' => 'index], ['routeClass' =>
'InflectedRoute']);
$routes->connect('/:controller/:action/*', [], ['routeClass' =>
'InflectedRoute']);
// This will be dropped for production. ;)
$routes->connect('/', [
'controller' => 'pages',
'action' => 'display',
'home'
]);
});
Still receiving Controller not found when i go directly to *[host]/captchas*
:
Missing Controller
*Error: * *CaptchasController* could not be found.
*Error: * Create the class *CaptchasController* below in file:
App\Controller\CaptchasController.php
<?php
namespace App\Controller;
use App\Controller\AppController;
class CaptchasController extends AppController {
}
Thanks a lot guys, for taking a look at this with me.
-joe
On Saturday, 30 August 2014 08:33:57 UTC-4, mark_story wrote:
>
> If Router::plugin() isn't getting you the routes you want, you can combine
> scope() and connect () to create the exact routes you want. Just keep in
> mind that all the routing data that doesn't change should be in the
> defaults list. For example
>
> $routes->connect('/captchas/:action/*', ['plugin' =>
> 'Thook/Websites','controller' => 'Captchas']);
>
> Would let you connect all the actions on the CaptchasController in your
> plugin.
>
> -mark
>
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.