ProcessWire’s API consists of a few different components

Variables

The API consists of a few variables (objects) which are provided to your site's template files. The two you are most likely to use are $page and $pages, where $page represents the current page being viewed, and $pages represents all the other pages in your site. These can be thought of like the "$" object in jQuery. ProcessWire's variables provide access to all the components in ProcessWire, including all the site's pages, users, templates and fields. They provide a means of finding, getting, creating, modifying, saving and deleting these types of data. The API can also be accessed by bootstrapping ProcessWire from another PHP script. More about API Objects.

Selectors

Another major component of ProcessWire's API are selectors. Like in jQuery, selectors are simple strings of text that specify fields and values. For example, "name=ryan" is a simple selector that says: "find items that have the name ryan." These selectors are used throughout ProcessWire to get and find pages (and other types of data). ProcessWire selectors resemble jQuery selectors in many instances, but are also quite different. More about ProcessWire selectors.

Fluent Interfaces

Most of the API objects in ProcessWire are chainable, using a fluent interface. This enables you to accomplish multiple operations on one line, for example:

echo $pages->get("/products/2010/")->find("template=faq, body*=Tobiko")->first()->url; 

Might print something like this:

/products/2010/sushi-knives/faq/ 

Of course, you don't have to chain statements like that unless you want to.

Module Plugin Architecture

ProcessWire is built around a modular architecture. Modules exist to enable a high level of extensibility and customization to an installation of ProcessWire. Nearly every component and action in ProcessWire is hookable. Much of ProcessWire itself is a collection of plugin modules. More about Modules

Comments

  • S.Zares

    S.Zares 7 years ago 63

    All Great things are simple!

    I like this solution.

Post a Comment

Your e-mail is kept confidential and not included with your comment. Website is optional.