# |
Jun 24th 2019, 17:19 |
admad |
apparently it skips setting the templatepath if you have already set view classname. So try doing that in your action method |
# |
Jun 24th 2019, 17:18 |
daniel.upshaw |
Hmm `_renderType` |
# |
Jun 24th 2019, 17:18 |
admad |
https://github.com/cakephp/cakephp/blob/master/src/Controller/Component/RequestHandlerComponent.php#L631=L639 |
# |
Jun 24th 2019, 17:17 |
daniel.upshaw |
Thank you for the input though, it just isn't taking for some reason |
# |
Jun 24th 2019, 17:17 |
daniel.upshaw |
Ah |
# |
Jun 24th 2019, 17:17 |
admad |
it has nothing to do with view class name |
# |
Jun 24th 2019, 17:14 |
slackebot |
[protected] _vars => [] }``` |
# |
Jun 24th 2019, 17:14 |
daniel.upshaw |
```object(Cake\View\ViewBuilder) { [protected] _templatePath => 'Admin/MenuLinks/ajax' [protected] _template => null [protected] _plugin => null [protected] _theme => 'CoreManager' [protected] _layout => null [protected] _autoLayout => null [protected] _layoutPath => 'ajax' [protected] _name => null [protected] _className => 'App' [protected] _options => [] [protected] _helpers => [ (int) 0 => 'CoreManager.Core' ] |
# |
Jun 24th 2019, 17:14 |
daniel.upshaw |
Wow even if I `$this->viewBuilder()->setClassName('App')` |
# |
Jun 24th 2019, 17:12 |
daniel.upshaw |
Could be `setClassName()` perhaps |
# |
Jun 24th 2019, 17:11 |
daniel.upshaw |
Putting it in `beforeRender()` did at least have an effect.. thanks for the input though, I can keep tinkering with this |
# |
Jun 24th 2019, 17:10 |
daniel.upshaw |
@admad Interestingly, even forcing the path to `$this->viewBuilder()->setTemplatePath('Admin/MenuLinks');`, it adds the `ajax` subfolder to that |
# |
Jun 24th 2019, 17:09 |
daniel.upshaw |
I'll try that to test |
# |
Jun 24th 2019, 17:09 |
daniel.upshaw |
Although then it might be for the whole controller |
# |
Jun 24th 2019, 17:09 |
admad |
beforeRender |
# |
Jun 24th 2019, 17:09 |
daniel.upshaw |
Maybe I need it in a beforeFilter method |
# |
Jun 24th 2019, 17:08 |
daniel.upshaw |
The `debug` call does say `null` |
# |
Jun 24th 2019, 17:08 |
daniel.upshaw |
Also tried an empty string `''`, and double checking `debug($this->viewBuilder()->getTemplatePath());` |
# |
Jun 24th 2019, 17:08 |
daniel.upshaw |
@admad That seems like it would be perfect... did try in the `index()` method setting `$this->viewBuilder()->setTemplatePath(null);` but it still tries to fetch the `ajax` subfolder |
# |
Jun 24th 2019, 16:52 |
admad |
@daniel.upshaw RequestHandler sets the template path to `ajax` subfolder. Use `viewBuilder()->setTemplatePath()` to reset it to `null`. |
# |
Jun 24th 2019, 16:36 |
daniel.upshaw |
What if you want to request the HTML page like the normal route? |
# |
Jun 24th 2019, 16:36 |
daniel.upshaw |
An AJAX call with jQuery.... Cake is requiring a separate `/ajax/index.ctp`, with a layout when it detects an AJAX call |
# |
Jun 24th 2019, 16:35 |
slackebot |
<daniel.upshaw> |
# |
Jun 24th 2019, 16:35 |
daniel.upshaw |
Here's something super annoying |
# |
Jun 24th 2019, 16:17 |
daniel.upshaw |
Lol darn |
# |
Jun 24th 2019, 16:17 |
daniel.upshaw |
Oy |
# |
Jun 24th 2019, 16:17 |
a.didier |
i see... I'm on a really old project and i'm not really used to Cake2 and the previous dev did some weird stuff XD Hard to understand |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
`app/View/Recipes/search.ctp` |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
`app/View/Recipes/share.ctp` |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
`app/View/Recipes/view.ctp` |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
So each of `view`, `share`, `search` generates a response |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
```# /app/Controller/RecipesController.php class RecipesController extends AppController { public function view($id) { //action logic goes here.. } public function share($customerId, $recipeId) { //action logic goes here.. } public function search($query) { //action logic goes here.. } }``` |
# |
Jun 24th 2019, 16:14 |
daniel.upshaw |
Controller should automatically generate a response, but you can customize it first if you need to |
# |
Jun 24th 2019, 16:14 |
daniel.upshaw |
The response is probably from here: https://book.cakephp.org/2.0/en/controllers.html |
# |
Jun 24th 2019, 16:13 |
daniel.upshaw |
So it would already know about `json` for example, so `type->('json')` is already prepared whereas as `vcf` needs `$this->response->type(array('vcf' => 'text/v-card'));` to be set first |
# |
Jun 24th 2019, 16:13 |
daniel.upshaw |
Although in the example, that's a custom one |
# |
Jun 24th 2019, 16:12 |
daniel.upshaw |
So by setting `type->('vcf');`, it's just adding the `text/v-card` MIME type to the headers |
# |
Jun 24th 2019, 16:12 |
daniel.upshaw |
@a.didier I think you can still use a template with a different response type |
# |
Jun 24th 2019, 16:02 |
a.didier |
Hello, quick question : I want to use CakeResponse on Cake2.10 but i have no idea on how to load it... The book show small code like this `$this->response->type('vcf');` nothing on how response is set... |
# |
Jun 24th 2019, 15:01 |
jeremyharris |
I believe the Croogo CMS has visual ACLs. I haven’t looked at it in a while but that might be a good example if they still have it |
# |
Jun 24th 2019, 14:59 |
feLiruc |
Hello guys... I need to implement ACL in a visual way for CakePHP 3.7, do you guys have any good source or tutorial to do that? |