Jump to content

PW variables in new admin page


diogo
 Share

Recommended Posts

I created a new page with parent and template "admin" and created a new module for that page process.

Among other things, i would like to list there all the children of another page with a module. Is there any way of using template variables inside the module, or it has to be done another way?

I looked on the forums, and tried to figure out by looking at other modules, but didn't find any answer.

Link to comment
Share on other sites

For the pages, you would use something like $yourpagelist = wire('pages')->get(your-selector-here)...

I thinkthe rest will more or less follow the same structure as above if you see what I mean?

Link to comment
Share on other sites

Diogo, Pete is right. You can also use $this->pages if you prefer it. But the nice thing about wire('pages') is that it's a constant that works anywhere whether in or out of a class, command line api, etc.

Link to comment
Share on other sites

I do like this solution. I digg a bit more on modules and saw that you also do something like: $pages = wire('pages'),

and then use $pages->get(), and so on, just like in templates.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...