Skip to content
Greg Bowler edited this page Aug 19, 2018 · 17 revisions

A Page View is a static HTML file that makes up the final rendered page and acts to fully separate the application's presentation from its logic. A Page View of "index.html" can be made dynamic by adding a Page Logic of "index.php".

There is another type of view/logic that shares the same concepts: API Webservices also have API View and API Logic files.

Routing

With many web frameworks, in order to link an incoming request to a view, a router must be used. The router is handled automatically within WebEngine, and is not exposed to the developer: the incoming request is simply matched to a file on disk. For example, the router will first try to match www.example.com/about with a file at /page/about.html, then check /page/about/index.html, then check for a dynamic file (see below). The view(s) will be loaded in from the matching HTML files, then matching logic files will be executed in context of the currently-loaded views.

Index files

The structure of WebEngine application URIs is that the path does not include an extension. This is sometimes referred to as directory-style URIs. This allows for page views to be stored within single files, or nested in directories.

Like in most systems, requesting a directory will serve the index within that directory. Because of this, the developer must be careful to not create clashing files and directories: A request to /contact will fail if there is a page/contact.html and a page/contact/index.html file present at the same time -- which one should the router choose?

Don't Repeat Yourself

// Headers and footers - why are they special to other template techniques - benefits of having site-wide header and footers.

// Custom components (DOM templates)

Dynamic views

// Views and URLs for dynamic content.

// /page/shop/{category}/{item}.html - how to reference the named dynamic variables "category" and "item".

Clone this wiki locally