diogo Posted January 20, 2012 Share Posted January 20, 2012 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 More sharing options...
Pete Posted January 20, 2012 Share Posted January 20, 2012 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 More sharing options...
diogo Posted January 20, 2012 Author Share Posted January 20, 2012 Great! Thanks Pete Link to comment Share on other sites More sharing options...
ryan Posted January 20, 2012 Share Posted January 20, 2012 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 More sharing options...
diogo Posted January 21, 2012 Author Share Posted January 21, 2012 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now