# |
Apr 18th 2019, 14:45 |
this.impetus |
got it. tyvm guys |
# |
Apr 18th 2019, 14:45 |
ricksaccous |
yeah that would be loadHelper |
# |
Apr 18th 2019, 14:44 |
ricksaccous |
which woul dbe |
# |
Apr 18th 2019, 14:44 |
ricksaccous |
yeah i'm saying in controller you would do $this->viewBuilder->setHelpers() and in the view you would use the other method i think |
# |
Apr 18th 2019, 14:43 |
this.impetus |
Sigh, I don't really even understand helpers, sorry. I mean conceptually I do, but I don't havea great concept of cake's architecture. What I *want* to achieve is a means of generating mouse-over thumbnails. The front-end JS stuff is where I am actually qualified. if only one class is going to be using this helper, is it not better to load it in the controller? |
# |
Apr 18th 2019, 14:42 |
neon1024 |
`$this->_viewBuilder->setHelpers();` ? |
# |
Apr 18th 2019, 14:41 |
ricksaccous |
and you would use a different method to do that |
# |
Apr 18th 2019, 14:41 |
ricksaccous |
but yes, it's probably better to add them in the AppView class |
# |
Apr 18th 2019, 14:41 |
ricksaccous |
you can add helpers that way |
# |
Apr 18th 2019, 14:41 |
this.impetus |
TBH, I *always* try. But I learned PHP years ago, and cake before it implemented namespace stuff, and I often find that I don't quite understand the API. |
# |
Apr 18th 2019, 14:41 |
neon1024 |
That’s not where you add helpers. |
# |
Apr 18th 2019, 14:41 |
ricksaccous |
lol |
# |
Apr 18th 2019, 14:41 |
ricksaccous |
he's using viewBuilder in controller |
# |
Apr 18th 2019, 14:40 |
neon1024 |
So the method does exist. Which means you must have a typo I’d imagine |
# |
Apr 18th 2019, 14:40 |
ricksaccous |
in your case setHelpers is more appropriate |
# |
Apr 18th 2019, 14:40 |
ricksaccous |
learn to use that more often and you'll have less questions in general |
# |
Apr 18th 2019, 14:40 |
neon1024 |
AppView::loadHelper has been in for 4 years |
# |
Apr 18th 2019, 14:39 |
ricksaccous |
;) |
# |
Apr 18th 2019, 14:39 |
ricksaccous |
@this.impetus https://api.cakephp.org/3.7/class-Cake.View.ViewBuilder.html |
# |
Apr 18th 2019, 14:39 |
this.impetus |
```$this->viewBuilder()->getHelpers(['Thumber.Thumb']);``` seems to have pleased cake |
# |
Apr 18th 2019, 14:39 |
ricksaccous |
actually it's best to check the API |
# |
Apr 18th 2019, 14:38 |
this.impetus |
yeah, haha. thanks. don't be surprised if I come back |
# |
Apr 18th 2019, 14:38 |
this.impetus |
anyway, I should at least try to solve this myself |
# |
Apr 18th 2019, 14:38 |
ricksaccous |
you can go through the docs to figure it out |
# |
Apr 18th 2019, 14:38 |
ricksaccous |
then figure out what the better method to use is |
# |
Apr 18th 2019, 14:38 |
this.impetus |
but I keep getting errors stating that `loadHelper` isn't a method |
# |
Apr 18th 2019, 14:38 |
ricksaccous |
hehe |
# |
Apr 18th 2019, 14:37 |
this.impetus |
oh? As in now that we know it's there and installed, use the current cake API to actually load it? yeah `->helpers` is deprecated |
# |
Apr 18th 2019, 14:37 |
ricksaccous |
is helpers deprecated? |
# |
Apr 18th 2019, 14:37 |
this.impetus |
nah I can prolly google that |
# |
Apr 18th 2019, 14:37 |
ricksaccous |
don't use the deprecated method would be my advice |
# |
Apr 18th 2019, 14:37 |
this.impetus |
And this works. Final question—how do I suppress the deprecation errors? |
# |
Apr 18th 2019, 14:36 |
this.impetus |
Ahhhhh |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
the second part is the actual name of the helper |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
the first part of the string is the plugin namespace |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
Thumber.Thumb |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
it would be |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
so |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
I don't think you include the Helper part |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
hehehehe |
# |
Apr 18th 2019, 14:36 |
this.impetus |
Thumb.Helper or something? |