Easily creating static pages

/ Published in: PHP
Save to your folder(s)

I needed to create several pages that didn't use any models and contained static data inside the default layout. My first thought was to create a controller for these pages and define an action for each static page I needed. However, this solution seemed tedious and would make it difficult to quickly add new pages. Enter the pages controller - simply create a view inside the views/pages/ folder and it'll automatically be rendered in /pages. For example, if I created /views/pages/matt.thtml it would be accessible via http://www.example.com/pages/matt

Copy this code and paste it in your HTML
  1. //No Source, check comments

URL: http://www.avatarfinancial.com/pages/cake

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.