Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use in View? #4

Closed
geoidesic opened this issue Dec 15, 2019 · 1 comment
Closed

How to use in View? #4

geoidesic opened this issue Dec 15, 2019 · 1 comment

Comments

@geoidesic
Copy link

Hi ADmad,

I'm trying to get this helper working. I followed the installation instructions but I can't figure out how to use it in my templates. Please could you add instructions for this?

I tried the following:

  1. Loaded the plugin to my AppView.php (none of these worked):
        $this->loadHelper('ADmad.Tree');
        $this->loadHelper('ADmad/Tree');
        $this->loadHelper('Tree');
  1. Tried to use it in the Template:
    I tried statically with:
use ADmad\Tree\View\Helper as Tree;
Tree::generate($myArrayOfData);

I tried dynamically with:

$this->Tree->generate($myArrayOfData);

Looking at the unit test I was confused... seems to be wrapping a view in Test, rather than loading it as a helper and also adding it as a behaviour to the model... I thought it was a view helper?

@ADmad
Copy link
Owner

ADmad commented Dec 15, 2019

Consult the Cake manual for how to load a plugin helper.

Then usage would be like:

echo $this->Tree->generate($data);

@ADmad ADmad closed this as completed Dec 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants