Для начала переходим в папку "Site - Templates". В эту папку, в корень, переносим всю папку "assets" из нашего проекта.
Далее редактируем файлы:
_init.php
<?php
namespace ProcessWire;
// Optional initialization file, called before rendering any template file.
// This is defined by $config->prependTemplateFile in /site/config.php.
// Use this to define shared variables, functions, classes, includes, etc.
require_once './_func.php';
$homepage = $pages->get('/');
$homeurl = '/';
_main.php
<?php
namespace ProcessWire;
// Optional main output file, called after rendering page’s template file.
// This is defined by $config->appendTemplateFile in /site/config.php, and
// is typically used to define and output markup common among most pages.
//
// When the Markup Regions feature is used, template files can prepend, append,
// replace or delete any element defined here that has an "id" attribute.
// https://processwire.com/docs/front-end/output/markup-regions/
/** @var Page $page */
/** @var Pages $pages */
/** @var Config $config */
include('./header.php');
?>
<pw-region id="content"></pw-region>
<?php
include('./footer.php');
Создаем файл _func.php и пишем функцию рендеринга блоков.
_func.php
<?php
namespace ProcessWire;
function renderBlocks($page) {
$out = '';
if ($page->hasField('blocks')) {
foreach ($page->blocks as $block) {
$out .= $block->render();
}
}
return $out;
}
function renderBlock($block) {
$out = '';
$out .= $block->render();
return $out;
}
Создаем файлы header.php и footer.php, и размещаем в них код нашего хеадера и футера, не забывая в начале этих фалов вставить namespace.
namespace
<?php
namespace ProcessWire;
?>
В пути картинок и скриптов ставим строку <?php echo $config->urls->templates?> перед assets.
Далее работаем с админкой.
Создаем темплейт blocks, ставим ему иконку Puzzle piece.
На основе этого темплейта создаем страницу Blocks, в ней дочерние элементы у нас будут блоками для сайта, делаем эту страницу скрытой.
Создаем поле Blocks типа Page Reference - Multiple pages: Select Multiple и устанавливаем ему Details - Multiple pages, Input - AsmSelect, Parent - Blocks. И шаблону Home мы добавляем это поле.
Затем правим home.php.
home.php
<?php
namespace ProcessWire;
// Template file for “home” template used by the homepage
// ------------------------------------------------------
// The #content div in this file will replace the #content div in _main.php
// when the Markup Regions feature is enabled, as it is by default.
// You can also append to (or prepend to) the #content div, and much more.
// See the Markup Regions documentation:
// https://processwire.com/docs/front-end/output/markup-regions/
?>
<div id="content">
ЗДЕСЬ РАЗМЕЩАЕМ НАШУ ВЕРСТКУ СТРАНИЦЫ
</div>
Далее создаем файл-шаблон в папке template для блока с контент-кодом html (не забываем в этих файлах ставить namespace от ProcessWire), в админке, в Template добавляем этот шаблон, в разделе Blocks добавляем новый блочный элемент с применением этого шаблона, и затем на домашней странице прикрепляем этот блок.