/controllers/ contains your optional Controller files, each of which applies to a single template. You can have Controllers for all of your templates, some of them, or none of them. Controller files should be named after the template they apply to and contain a class extending wireframe\Controller:
- Controller class for home template should be named HomeController and placed in a file called /site/templates/controllers/HomeController.php.
- Controller class for basic-page template should be named BasicPageController and placed in a file called /site/templates/controllers/BasicPageController.php.
- ... and so on and so forth.
/lib/ should contain any additional code that doesn't fit into controllers: utility classes and functions (and anything along those lines), third party libraries not installed with Composer, site-specific configuration files, etc.
/views/ contains view files, each of which implement an individual views for a template. Each template may have multiple views: for an example you could have "default" view for rendering the home page as HTML, and "rss" view for rendering a feed of your latest posts as RSS instead.
/layouts/ contains layout files, which provide the shared "page frame", i.e. the <head> and <footer> sections and any other repeating elements used by many different templates.
/partials/ contains partials, which are smaller, reusable view files containing specific parts of the site or common features shared among multiple pages – top menu and breadcrumbs are typical examples of partials.
Here's the entire (default) directory structure:
. ├── admin.php ├── controllers │ └── HomeController.php ├── errors │ └── 500.html ├── lib ├── layouts │ └── default.php ├── partials │ └── menu │ ├── breadcrumbs.php │ └── top.php ├── resources │ ├── css │ │ └── main.css │ ├── images │ └── js │ └── main.js ├── views │ ├── basic-page │ │ └── default.php │ └── home │ ├── default.php │ └── json.php └── wireframe.php
Creating required directories automagically
Since version 0.3.0 Wireframe has provided an option for creating the required directories (lib, layouts, partials, and views) automatically. This feature can be found from the Wireframe module configuration screen, and only requires checking the checkbox fields next to the directories you want the module to create for you.
Note: this feature requires ProcessWire to have write access to the parent directory of the Wireframe directories, and as such may not be available in all environments.