Dialogs Framework Basic Concepts

Dialogs Templates: Page Templates

Updated: 21 Apr 2023


Page Templates define the overall webpage layout. Each Dialogs Page (item on the Pages List) is associated with a specific Page Template for rendering. Developers can copy and paste HTML directly into the page template via the browser-based Control Panel, or via FTP. 

  • Access Page Templates from the Design section of the primary Dialogs menu.
  • Add a new template by clicking the Add button.
  • Edit existing templates by clicking the edit button of a particular template row.
  • Each Page Template should have a unique name.
  • By default, each revision to the Page List list will be saved as a revision.
  • Dialogs stores Page Templates as actual files on the webserver. This allows direct editing of the files by external editors and updates via FTP.  NOTE: Dialogs only saves revisions of changes made via the browser-based control panel; changes made to the file outside of Dialogs are not saved as revisions.

Page templates may contain HTML, PHP, Javascript, and CSS. Page Templates may include other Page Templates and List Templates. Some developers prefer to create multiple Page Templates for a website, one for each page layout. Some Developers prefer to place logic in a single Page Template to differentiate layout based upon characteristics of the page (such as a "body class" field, or Page Group name or id). Either method works very well in Dialogs.

Content from the Pages or other Lists will be merged with the template when the page is rendered. Mail-merge-type tokens define fields or List Templates to show and may be used anywhere in the Page Template.

  • Insert a Page List field (body, sidebar, header, etc.) Insert a PHP echo with the field referenced from the $row array within PHP tags as follows:
...	echo $this->db_page_row['body']; ?>...
  • Call a List (to show a list on all pages that use that Page Template) Insert the function Show_List within PHP tags as follows:
... echo $this->Show_List('list_my_list_tpl_name.'); ?>...
  • Insert another Page Template (multiple Page Templates may all call a common header or footer Page Template) Insert the PHP include_once within PHP tags as follows:
...include_once('inc/DIA_inc_header.tpl.inc.php'); ?>...

Review the default Page Templates included in the basic Dialogs installation to see several examples.

 

Next: Dialogs Templates: List Templates

LinkedInFacebookYouTubeTwitter