# Creating Custom Templates Templates control the HTML structure and presentation of your content. This guide covers advanced template creation, from simple page layouts to complex list views. ## Template Hierarchy FolderWeb uses a three-level template system: 1. **Base template** (`base.php`) — The HTML scaffold wrapping everything 2. **Content template** — Either `page.php` or a list template 3. **Partials** (optional) — Reusable components you create ``` base.php └── page.php or list.php └── Rendered content ``` ## Template Resolution When rendering a page, FolderWeb looks for templates in this order: **For page views:** 1. `custom/templates/page.php` 2. `app/default/templates/page.php` (fallback) **For list views:** 1. `custom/templates/{page_template}.php` (e.g., `list-grid.php`) 2. `custom/templates/list.php` 3. `app/default/templates/{page_template}.php` 4. `app/default/templates/list.php` (fallback) **For base:** 1. `custom/templates/base.php` 2. `app/default/templates/base.php` (fallback) ## Creating a Custom Base Template The base template defines the HTML structure for every page. ### Step 1: Copy the Default ```bash cp app/default/templates/base.php custom/templates/base.php ``` ### Step 2: Customize **custom/templates/base.php:** ```php
= htmlspecialchars($item['summary']) ?>
= htmlspecialchars($featured['summary']) ?>
Read article →= htmlspecialchars($post['summary']) ?>
By = htmlspecialchars($metadata['author']) ?>
By = htmlspecialchars($metadata['author']) ?>
``` ### 3. Use Semantic HTML ```php