What it does
basic is the theme that ships with Scriptor and renders a fresh
install out of the box. It is a complete, working theme rather than a
stub: UIkit-based semantic markup, a per-page template chain, a
SuperCache layer, a small router for contact-form and newsletter
actions, and Prism for code highlighting. It lives in themes/basic/
and is the natural thing to fork when you want your own look without
starting from an empty directory.
It is not a plugin: a theme owns the frontend HTML, the asset
pipeline, and the template chunks. It ships as a Composer package of
type scriptor-theme and is selected by Scriptor's theme loader, not
discovered through the plugin manifest.
Install
basic is already present in a stock Scriptor install; there is
nothing to require. To base your own theme on it, copy the directory
and rename it:
cp -r themes/basic themes/atelier
then point Scriptor at the new theme in your site config and start
editing. The Build a Theme
tutorial walks the from-scratch path (mini-case: bigins/atelier) if
you would rather understand each file as you add it.
Configure
A theme is configured through its own theme-config file and the
template chunks, not a plugins.* block. Two surfaces matter:
-
themes/basic/composer.jsondeclares the autoload for the theme'slib/classes:{ "autoload": { "classmap": ["lib"] } } -
Theme content/config (
getTCP): templates pull per-template config through$site->getTCP('<template>'), e.g. the blog template's sidebar headers and about text. That is where copy-and-paste theme strings live.
The theme's structure under themes/basic/:
themes/basic/
├── _ext.php # bootstrap: instantiates BasicTheme + BasicRouter
├── template.php # picks <currentTemplate>.php, else default.php
├── default.php # the fallback page template
├── blog.php # per-template layouts (blog, blog-post, contact, 404)
├── lib/ # BasicTheme, BasicRouter, subscriber/
└── resources/ # _head, _header, _footer, _offcanvas chunks
Use
The theme's request flow is worth seeing, because it is the model any fork inherits:
_ext.php is the entry point. It builds the BasicTheme (the $site
object) from the DI container, tries a SuperCache hit first, and
otherwise hands off to BasicRouter:
use Scriptor\Boot\App;
use Themes\Basic\BasicRouter;
use Themes\Basic\BasicTheme;
require_once __DIR__ . '/vendor/autoload.php';
$site = new BasicTheme(App::container(), $config, dirname(__DIR__, 2));
$cached = $site->hitCache();
if ($cached !== null) {
(new BasicRouter($site))->actions(); // still process form submits
echo $cached;
$site = null; // tell index.php not to re-render
return;
}
(new BasicRouter($site))->execute();
template.php then selects the per-page template by name, falling
back to default.php:
$tplName = $site->sanitizer->templateName($site->currentTemplate());
$tplFile = __DIR__ . "/$tplName.php";
ob_start();
include file_exists($tplFile) ? $tplFile : __DIR__ . '/default.php';
echo $site->cache();
Inside a template, content is assembled from named render slots:
<?php echo $site->render('hero') ?>
<h1><?php echo $site->page->name ?></h1>
<?php echo $site->render('messages') ?>
<?php echo $site->render('content'); ?>
render('content') dispatches the ContentRendering event, which is
exactly where plugins like
scriptor-markdown-pages and
scriptor-markdown-containers inject
their HTML. Asset URLs are resolved through $site->themeAssetUrl()
and $site->editorAssetUrl() so a theme can ship its own JS/CSS while
reusing the editor's bundled Prism.
Links
- Source:
themes/basic/in the Scriptor repository - Type:
scriptor-theme(bundled; no separate install) - License: MIT (ships with Scriptor)
- Tutorial: Build a Theme builds a theme from an empty directory; Publishing your extension covers shipping it as a package.
- Starter skeleton: the Example Theme issue tracks a separate ready-to-fork starter.