# HG changeset patch # User jbe # Date 1503280713 -7200 # Node ID 696d7e5f2bcb29f8f3fd01e0081a7ff31cb9d626 # Parent 6c819040ef6fb8646415433d17bf15906d0a35a6 Added "Layouts" section to WebMCP documentation and cleaned "Directory structure" section up diff -r 6c819040ef6f -r 696d7e5f2bcb doc/autodoc-header.htmlpart --- a/doc/autodoc-header.htmlpart Mon Aug 21 01:33:17 2017 +0200 +++ b/doc/autodoc-header.htmlpart Mon Aug 21 03:58:33 2017 +0200 @@ -269,7 +269,31 @@

Actions are similar to views, but supposed to change data in the database, hence only callable by HTTP POST requests. They are also responsible for processing the POST parameters from the webbrowser. They can modify the database, but instead of rendering a page to be displayed, they just return a status code string (via Lua's return statement, where true can also be used instead of "ok", and false instead of "error"). Depending on the status string there will be an internal forward or an HTTP 303 redirect to a view. When calling an action via a POST request, additional POST parameters, which are usually added by hidden form fields, determine the view to be displayed for each status string returned by the action. See the routing parameter to the ui.form{...} function for further details.

+

Layouts

+

+ Templates for HTML documents to be returned by views are stored at the path "app/application_name/_layout/layout_name.html", relative to the application base path. The default layout name is "default". For system errors, the layout name "system_error" is used. A sample layout is given as follows: +

+
+<!DOCTYPE HTML>
+<html>
+  <head>
+    <title><!-- WEBMCP SLOTNODIV title --></title>
+    <link rel="stylesheet" type="text/css" media="screen" href="__BASEURL__/static/style.css"/>
+  </head>
+  <body>
+    <!-- WEBMCP SLOT content -->
+  </body>
+</html>
+

+ The following elements in a layout file get replaced automatically: +

+

Directory structure of a WebMCP application

+ Summarizing information from the previous section, we get the following directory structure for a WebMCP application: