Repository navigation
Editing Templates
Files ending in .tpl (and .div) are Div templates; untitled windows are treated as templates too.
Every construct of the language has its own colour: replacements and their modifiers ({$x}, {^^title}, {html:body}, {$body:~25}), loops and their item names, conditions, template variables and their JSON, includes, formulas, number and date formats, comments and documentation blocks, macros, ignored blocks… Div code nested inside other Div code is highlighted too, and the HTML between tags is coloured lightly so that the Div stays in front.
Div lets a template change its tags with @_DIALECT = file.dialect. divide highlights, checks and completes with your tags, and the status line shows the dialect's name.
Which file that is, and what it says, is Div's business: divide asks Div to load the dialect as it does when it renders. Div finds the file with getTplPath() (relative to the working directory, to the template's folder, to the templates included before) and decodes it with its own jsonDecode(). If Div cannot find the file or cannot decode it, the @_DIALECT line is reported as an error. Until Div answers, or without PHP and Div, divide guesses the file only to colour the template and reports nothing about it. Like includes, the dialect is resolved from the template's folder, so it is checked once the template is saved (see Save first in Checking Templates). To build a dialect, use the Dialector; to move a template to another dialect, Translating Templates.
| Key | |
|---|---|
| Ctrl+F | Find |
| Ctrl+R | Replace |
| Ctrl+L | Search again (repeats the last find or replace) |
| Ctrl+G | Go to line number |
The dialogs are the classic ones: case sensitive, whole words only, regular expressions (with \1 groups in the replacement), forward or backward, from the cursor or the entire file, and prompt on replace to confirm each change. The selected text, or the word under the cursor, is proposed as what to find.
Find wraps around: past the last match it goes on from the start of the file (searching backward, from its end), and the status line says Search wrapped around. When the text is nowhere in the file, a message box names it.

The usual ones work: arrows, Home/End, PgUp/PgDn, Shift to select, Ctrl+Z / Ctrl+Y undo and redo, Ctrl+X/C/V cut, copy and paste, Ctrl+A select all, Tab indents, Enter keeps the indentation of the line it breaks (F7 opens the Render Trace). Ctrl+Space opens Completion, Ctrl+Enter goes to the template an include points to (see Checking Templates), Ctrl+O lists the template's tags to jump to them (see Outline).
Data files (.json, .dialect) are Div JSON: see Data Files. PHP files have their own editor: see Editing PHP. Any other file opens as plain text.
divide · part of Divengine · report an issue
Manual
- The Desktop
- Editing Templates
- Editing PHP
- Outline
- Finding Files and Commands
- Language Servers
- Completion
- Checking Templates
- Rendering
- Render Trace
- Running PHP
- Running Flows
- Flow Structure
- Flow Designer
- Flow Functions
- Flow Simulation
- Function Mock Simulation
- Debugging PHP
- Web Server
- Data Files
- Other Files
- Project Window
- Div Setup
- Dialector
- Translating Templates
- Composer
- Git
Reference
Links