Jump to content

how does wire("pages")/wire("page") work?


seedle
 Share

Recommended Posts

Hi seedle,

Firstly, 2.5 is the current stable version so you should grab that instead.

As for page/pages:

http://processwire.com/api/variables/page/

http://processwire.com/api/variables/pages/

I am not really sure what information you need, but to clarify, wire('page') is effectively the same as $page, but due to PHP variable scope $page is not available inside your own functions, inside PW modules, or on a script that is bootstrapped to PW. That is when you need to use wire('page'). Same goes for all the PW variables: wire('input'), wire('sanitizer'), wire('user') etc.

If you are wondering what $page and $pages are actually for. Basically, $page gives you access to all the fields on the currently viewed page on your site, eg: $page->body

$pages gives you access to all pages on your site - you can query the pages you want using selectors, which are Processwire's version of database queries.

It sounds like you might benefit from reading through some of the new tutorials: http://processwire.com/docs/tutorials/ and of course the cheatsheet: http://cheatsheet.processwire.com/

Hope that helps!

  • Like 8
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...