Module 6: Modules and views
A module view is how an extension gets pages of its own. This module explains how an address reaches a view,
then learners build the view hello/greet step by step: parameters and a template, a policy function and a role,
and finally a form with an action, validation and a redirect, protected by the form token.
At a glance
| Course | Developers |
| Duration | 3 hours 35 minutes (with one 10-minute break) |
| Lessons | 4 |
| Level | Intermediate |
Lessons
| Lesson | Duration | What learners do |
|---|---|---|
| Lesson 6.1: How modules and views work | 45 minutes | Split addresses, read module.php, follow a view to its class |
| Lesson 6.2: A view of your own | 55 minutes | Write hello/greet with parameters, a template and a breadcrumb |
| Lesson 6.3: Policies for your views | 50 minutes | Declare greet as a policy function, grant it to the Anonymous role |
| Lesson 6.4: Forms and actions in a view | 55 minutes | Post a form, validate, redirect, see the form token at work |
Preparing this module
- Each learner has the
hellomodule from lesson 5.4 and an administrator account on their own training installation; lesson 6.3 changes the Anonymous role, which must not be shared between learners. - Know how your training site is matched (by path such as
/site/, or by host) so learners type the right addresses. - Keep a finished
module.php,greet.phpandgreet.tplat hand for learners who fall behind. - Rehearse lesson 6.4 step 8 in the browser you will use on the projector: removing a field with the developer tools differs slightly between browsers.
Timing plan
| Part | Minutes |
|---|---|
| Lesson 6.1 | 45 |
| Lesson 6.2 | 55 |
| Break | 10 |
| Lesson 6.3 | 50 |
| Lesson 6.4 | 55 |
| Total | 215 |
Related pages
- Developers: course overview
- Trainers: start here
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.