Last Updated: December 29, 2024
Author: Shanta
Status: Active
The Pages controller manages the content management system for the Ency schema. It provides a simple, practical approach to storing and delivering page content sorted by SiteName and roles, following existing Catalyst patterns and practices.
/page/{page_code} - View a single page (e.g., /page/home)/pages - List pages for current site/pages?menu=Main - List pages by menu/pages/create - Create new page form/pages/edit/{page_code} - Edit existing page (e.g., /pages/edit/home)The Pages controller uses a single pages table in the Ency schema:
| Field | Type | Description |
|---|---|---|
| id | INT AUTO_INCREMENT | Primary key |
| sitename | VARCHAR(255) | Site identifier (CSC, MCOOP, etc.) |
| menu | VARCHAR(255) | Menu category (Main, member, Admin) |
| page_code | VARCHAR(255) | Unique page identifier |
| title | VARCHAR(255) | Page display title |
| body | TEXT | HTML content body |
| description | TEXT | Meta description for SEO |
| keywords | TEXT | Meta keywords for SEO |
| link_order | INT | Display order in navigation |
| status | VARCHAR(50) | Page status (active, inactive, draft) |
| roles | VARCHAR(255) | Required access roles (public, member, admin) |
| created_by | VARCHAR(255) | Username who created the page |
| created_at | DATETIME | Creation timestamp |
| updated_at | DATETIME | Last modification timestamp |
/page/{page_code}pages/view.tt/pagesmenu (optional, defaults to 'Main')pages/list.tt/pages/createpages/create.tt/pages/edit/{page_code}pages/edit.ttThe controller implements role-based access control:
All templates follow existing TT patterns with PageVersion tracking:
pages/view.tt: Single page display with admin controlspages/list.tt: Page listing with filtering and admin controlspages/create.tt: Page creation form with validationpages/edit.tt: Page editing form with metadata displaymysql ency < sql/pages_ency.sqlperl script/migrate_pages.plTo test the page system, try these URLs:
http://your-domain/pages - List all pageshttp://your-domain/page/home - View home page (if it exists)http://your-domain/pages/create - Create page form (admin only)Comserv::Util::Logging$c->model('Ency::Page')