Hey, that's great news!
I was going to bake a plugin application this evening to see if I could
reproduce your problem. I'm glad you could figure it out!
On Sunday, August 31, 2014 5:42:21 PM UTC+2, Joe Theuerkauf wrote:
>
> Okay, i think i'm finally on the right track.
>
> As i noted, going to [host]/captchas was giving a Controller-not-found
> error. i realize now it's because the route connecting '/captchas' required
> an action to match... Oops. After trying the full URL that the Captcha
> validator uses, i got a JSON response, but it was a 500 error, the database
> was still trying to find the table *kodiak.captchas*. Changed
> *TableRegistry::get('Captchas')* to
> *TableRegistry::get('Thook/Websites.Captchas')* and got a JSON response i
> expected.
>
> i know most of this is considered basic stuff, so i appreciate the
> patience in trying to help me. At least i'm trying to figure it out on my
> own while i wait for help, right? :)
> -joe
>
>
>
> On Saturday, 30 August 2014 12:28:50 UTC-4, Joe Theuerkauf wrote:
>>
>> @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.