Five minutes to set expectations. After this chapter you have not written any code yet. You have a sketch of the destination, a list of the rails you'll ride on, and a small to-do list to align your local Scriptor install with the tutorial.
What "done" looks like
At the end of chapter 6 you will be able to:
- Drop a folder called
atelier/intothemes/of any Scriptor install, - set
'theme_path' => 'atelier/'indata/settings/custom.scriptor-config.php(the update-safe override; chapter 2 covers the file), - reload the site, and
- see a finished portfolio site with a working blog, contact form and 404 page, without writing more code.
The finished theme is publishable too: a tagged Composer package
that someone else can composer require from a custom theme repo.
The target page tree
You'll build Atelier against a small page tree. Three pages are the bare minimum to make navigation feel real; the others fall in as you go:
Home template=home (showcase / hero)
About template=basic (one long page)
Projects template=projects (gallery of child pages)
├── Project A template=basic
├── Project B template=basic
└── Project C template=basic
Contact template=contact (form on a basic page)
The Blog is not in the page tree. It lives as markdown files
under the theme's own content/blog/ directory and is mounted by
the markdown-pages plugin you'll install in chapter 5.
Set this up before chapter 3. Open the editor at
/editor/pages/on your local Scriptor install, create About, Projects, three child pages under Projects, and Contact. Leave each child page'stemplatefield asbasicfor now; you'll change Projects toprojectsin chapter 3.
The exact titles, slugs and content don't matter. You just need some DB pages so navigation has something to walk.
The rails
Every chapter rides four rails:
- Scriptor's
Siteclass. Your theme will eventually subclass it. Until then, the defaultSiteis enough. - A
template.phpdispatcher. One file, six lines, picks the right page template based on$page->template. You'll write it in chapter 2 and never touch it again. - The
$site->render('content' | 'navigation' | …)surface. Theme code only ever calls these helpers; no SQL, noPageRepositorylookups, no PSR-14 dispatching in templates. - A
composer.jsonwith aclassmapforlib/. That is the whole "package" story for a theme. There is no"type": "scriptor-theme"marker; Scriptor finds your theme by directory name only.
If any of these phrases sound new, the relevant Concept chapter is linked at the top of the chapter where it shows up.
The rules of the road
Three guard-rails to keep the result honest:
- No SQL or repository lookups in templates. Templates call
$site->render('content'),$site->page->name, etc. The day you reach for$site->pages->find()inside a.phptemplate, stop and move that into aSitesubclass method. - No business logic in
template.php. It exists to dispatch to a per-template file and nothing else. The pattern is the same in every theme; chapter 2 shows it. - Plugin-owned data stays inside the plugin. Your theme will consume what the markdown-pages plugin offers, never reach into the plugin's content tree directly. Chapter 5 shows the right hook.
To-do before chapter 2
- Working Scriptor install:
composer installclean andphp bin/scriptor installran successfully (seedocs/install.mdif you have not done this yet). -
/editor/pages/accessible with the admin credentials you set during install; at least one page exists. - Create the page tree from the Target page tree section above (you can fill them with placeholder content).
- Pick an empty directory name. Scriptor splits each theme
across two paths:
themes/<name>/for PHP source (templates, partials, lib) andpublic/themes/<name>/for browser-served assets (CSS, JS, images). We'll useatelierthroughout; substitute your own if you prefer. Chapter 2 walks creating both directories.
When all four boxes are ticked, open chapter 2 and write your first
template.php.
Behind the scenes. The page-tree contract Atelier rides on is
documented in
docs/imanager-2.0-plan.md
and in the Concepts → Frontend Nav Registry chapter you'll lean
on in chapter 4. The Site class itself lives at
boot/Frontend/Site.php.