This is the code I have for the main.pdt file:
<?php
/**
* CMS main controller
*
* @package blesta
* @subpackage blesta.plugins.cms.controllers
* @copyright Copyright (c) 2010, Phillips Data, Inc.
* @license http://www.blesta.com/license/ The Blesta License Agreement
* @link http://www.blesta.com/ Blesta
*/
class Main extends CmsController {
/**
* Pre-action
*/
public function preAction() {
parent::preAction();
$this->uses(array("PluginManager", "Cms.CmsPages"));
// Redirect if this plugin is not installed for this company
if (!$this->PluginManager->isInstalled("cms", $this->company_id))
$this->redirect($this->client_uri);
// Use the same structure as that of the client portal for the company given
$this->structure->setDefaultView(APPDIR);
$this->structure->setView(null, "client" . DS . $this->layout);
$this->structure->set("custom_head",
"<link href=\"" . Router::makeURI(str_replace("index.php/", "", WEBDIR) . $this->view->view_path) . "views/" . $this->view->view . "/css/styles.css\" rel=\"stylesheet\" type=\"text/css\" />"
);
$this->base_uri = WEBDIR;
$this->view->base_uri = $this->base_uri;
$this->structure->base_uri = $this->base_uri;
// Set the client info
if ($this->Session->read("blesta_client_id")) {
$this->client = $this->Clients->get($this->Session->read("blesta_client_id"));
$this->view->set("client", $this->client);
$this->structure->set("client", $this->client);
}
}
/**
* Portal/CMS index
*/
public function index() {
$uri = "/";
if (isset($this->get[0]))
$uri = $this->get[0];
$this->uses(array("Cms.CmsPages", "PluginManager"));
// Load the template parser
Loader::load(VENDORDIR . "h2o" . DS . "h2o.php");
$parser_options_html = Configure::get("Blesta.parser_options");
// Don't escape html
$parser_options_html['autoescape'] = false;
// Check if the page exists
if (($page = $this->CmsPages->get($uri, $this->company_id))) {
// Get installed plugins
$plugins = $this->PluginManager->getAll($this->company_id);
$installed_plugins = array();
foreach ($plugins as $plugin)
$installed_plugins[$plugin->dir] = $plugin;
// Set page content
$url = rtrim($this->base_url, "/");
$tags = array(
'base_url' => $this->Html->safe($url),
'blesta_url' => $this->Html->safe($url . WEBDIR),
'client_url' => $this->Html->safe($url . $this->client_uri),
'admin_url' => $this->Html->safe($url . $this->admin_uri),
'plugins' => $installed_plugins
);
$page->content = H2o::parseString($page->content, $parser_options_html)->render($tags);
$this->set("content", $page->content);
$this->structure->set("page_title", $page->title);
$this->structure->set("title", $page->title);
}
else {
switch($uri) {
case 'services':
$this->structure->set("page_title", "*** INSERT PAGE TITLE ***");
$this->structure->set("title", "*** INSERT TITLE SHOWN ON PORTAL TEMPLATE ***");
// Placeholders won't work with this method, so let's use variables
$url = rtrim($this->base_url, "/");
$blesta_url = $this->Html->safe($url . WEBDIR);
$html = <<<EOT
<div class="col-md-4 col-sm-6 portal-box">
<a href="{$blesta_url}services>
<div class="well">
<i class="fa fa-cogs fa-4x"></i>
<h4>Foo</h4>
<p>Bar.</p>
</div>
</a>
</div>
EOT;
$metatags = <<<EOT
<meta property="og:title" content="Examplehost"/>
<meta property="og:description" content="Web Design and Development Services"/>
<meta property="og:image" content="https://examplehost.net.au/images/"/>
<meta property="og:url" content="https://examplehost.net.au/billing"/>
EOT;
$this->structure->set("metatags" , $metatags);$this->set("content", $html);
break;
default:
$this->redirect($this->base_uri);
}
}
}
}
?>
and this for structure.pdt
<!DOCTYPE html>
<html dir="<?php echo (in_array($this->_("AppController.lang.dir", true), array("ltr", "rtl")) ? $this->_("AppController.lang.dir", true) : "ltr");?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $this->Html->safe(($this->Html->ifSet($page_title) ? $page_title . " | " : "") . $this->Html->ifSet($system_company->name));?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php echo $this->Html->ifSet($metatags) ?>
<link rel="shortcut icon" href="<?php echo $this->view_dir;?>images/favicon.ico" />
<link href="<?php echo $this->view_dir;?>css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->view_dir;?>css/styles.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->view_dir;?>css/slider.css" rel="stylesheet" type="text/css" />
<?php
// Theme CSS
if (isset($theme_css)) {
?>
<link href="<?php $this->Html->_($theme_css);?>" rel="stylesheet" type="text/css" media="screen" />
<?php
}
if ($this->_("AppController.lang.dir", true) == "rtl") {
?>
<link href="<?php echo $this->view_dir;?>css/rtl.css" rel="stylesheet" type="text/css" media="screen" />
<?php
}
?>
<link href="<?php echo $this->view_dir;?>font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo $this->view_dir;?>javascript/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $this->view_dir;?>javascript/bootstrap.min.js"></script>
<!--[if lt IE 10]><script type="text/javascript" src="<?php echo $this->view_dir;?>javascript/history/json2.js"></script><![endif]-->
<script type="text/javascript" src="<?php echo $this->view_dir;?>javascript/history/history.adapter.jquery.js"></script>
<script type="text/javascript" src="<?php echo $this->view_dir;?>javascript/history/history.js"></script>
<!--[if lt IE 10]><script type="text/javascript" src="<?php echo $this->view_dir;?>javascript/history/history.html4.js"></script><![endif]-->
<script type="text/javascript" src="<?php echo $this->view_dir;?>javascript/jquery-client-3.5.0.js"></script>
<?php
echo $this->Javascript->getFiles("head");
echo $this->Html->ifSet($custom_head);
?>
<!--[if lt IE 9]>
<script src="<?php echo $this->view_dir;?>javascript/html5shiv.js" type="text/javascript"></script>
<script src="<?php echo $this->view_dir;?>javascript/respond.min.js" type="text/javascript"></script>
<![endif]-->
<?php echo $this->Html->ifSet($head);?>
</head>
<body>
<?php echo $this->Html->ifSet($body_start);?>
<?php
if ($this->Html->ifSet($show_header, true)) {
?>
<div class="header">
<div class="container">
<div class="logo">
<a href="<?php echo $this->Html->safe($this->base_uri);?>">
<?php
if (!empty($theme_logo)) {
?>
<img src="<?php $this->Html->_($theme_logo);?>" alt="Logo" />
<?php
}
elseif (!empty($blesta_logo)) {
?>
<img src="<?php $this->Html->_($blesta_logo);?>" alt="Blesta" />
<?php
}
else {
?>
<img src="<?php echo $this->view_dir;?>images/logo.png" alt="Blesta" />
<?php
}
?>
</a>
</div>
<?php
if ($this->Html->ifSet($staff_as_client)) {
?>
<span class="label label-info pull-right"><a href="<?php echo $this->Html->safe($this->admin_uri . "clients/logoutasclient/");?>"><span class="fa fa-info-circle"></span> <?php $this->_("AppController.client_structure.staff_as_client_note");?></a></span>
<?php
}
?>
</div>
</div>
<div class="title">
<div class="container">
<h3><?php echo ($this->Html->ifSet($title) ? $this->Html->_($title, true) : $this->_("AppController.client_structure.default_title", true));?></h3>
</div>
</div>
<?php
if (!$this->Html->ifSet($logged_in)) {
?>
<div class="clearfix"></div>
<div class="no-nav"></div>
<?php
}
else {
?>
<div class="nav-content">
<div class="nav">
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only"><?php $this->_("AppController.sreader.navigation");?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<div class="container">
<?php
$active_nav = null;
?>
<ul class="nav navbar-nav">
<?php
foreach ($this->Html->ifSet($nav, array()) as $link => $value) {
$attributes = array();
$link_attributes = array();
$dropdown = !empty($value['sub']);
$active = false;
if ($value['active']) {
$active = true;
$attributes['class'][] = "active";
$active_nav = $value;
}
if ($dropdown) {
$attributes['class'][] = "dropdown";
$link_attributes['class'][] = "dropdown-toggle";
$link_attributes['data-toggle'][] = "dropdown";
// Set parent to active if child is
if (!$active) {
foreach ($this->Html->ifSet($value['sub'], array()) as $sub_link => $sub_value) {
if ($sub_value['active']) {
$attributes['class'][] = "active";
break;
}
}
}
}
?>
<li<?php echo $this->Html->buildAttributes($attributes);?>>
<a href="<?php $this->Html->_($link);?>"<?php echo $this->Html->buildAttributes($link_attributes);?>>
<i class="<?php $this->Html->_($value['icon']);?>"></i>
<?php
$this->Html->_($value['name']);
if ($dropdown) {
?>
<b class="caret"></b>
<?php
}
?>
</a>
<?php
if (!empty($value['sub'])) {
?>
<ul class="dropdown-menu">
<?php
foreach ($this->Html->ifSet($value['sub'], array()) as $sub_link => $sub_value) {
?>
<li>
<a href="<?php $this->Html->_($sub_link);?>"><i class="<?php $this->Html->_($sub_value['icon']);?>"></i> <?php $this->Html->_($sub_value['name']);?></a>
</li>
<?php
}
?>
</ul>
<?php
}
?>
</li>
<?php
}
?>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<?php $this->Html->_($contact->first_name);?> <?php $this->Html->_($contact->last_name);?>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="<?php echo $this->Html->safe($this->client_uri . "main/edit/");?>"><i class="fa fa-edit fa-fw"></i> <?php $this->_("AppController.client_structure.text_update_account");?></a></li>
<?php
if ($this->Html->ifSet($portal_installed, false)) {
?>
<li><a href="<?php echo $this->Html->safe(WEBDIR);?>"><i class="fa fa-circle-o fa-fw"></i> <?php $this->_("AppController.client_structure.text_return_to_portal");?></a></li>
<?php
}
?>
<li class="divider"></li>
<li><a href="<?php echo $this->Html->safe($this->client_uri . "logout/");?>"><i class="fa fa-sign-out fa-fw"></i> <?php $this->_("AppController.client_structure.text_logout");?></a></li>
</ul>
</li>
</ul>
</div>
</div><!-- /.navbar-collapse -->
</nav>
</div>
</div>
<?php
}
}
?>
<!-- Begin Content -->
<div class="container">
<div class="row<?php echo (!$this->Html->ifSet($show_header, true) ? " login" : "");?>">
<?php
if (!empty($active_nav['secondary'])) {
?>
<div class="col-md-3">
<div class="list-group">
<?php
foreach ($active_nav['secondary'] as $link => $value) {
?>
<a href="<?php $this->Html->_($link);?>" class="list-group-item left-nav <?php echo ($value['active'] ? "active" : "");?>">
<i class="<?php $this->Html->_($value['icon']);?>"></i>
<?php
$this->Html->_($value['name']);
?>
</a>
<?php
}
?>
</div>
</div>
<div class="col-md-9">
<div class="row">
<?php echo $content;?>
</div>
</div>
<?php
}
else {
echo $content;
}
?>
</div>
<div class="row footer">
<div class="col-md-12">
<hr />
<p class="text-center">Powered by <a href="http://www.blesta.com/">Blesta</a>, © Phillips Data, Inc.</p>
</div>
</div>
</div>
<div class="modal fade" id="global_modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="global_modal_title"></h4>
</div>
<div class="modal-body"><i class="fa fa-spinner fa-spin"></i></div>
<div class="modal-footer"></div>
</div>
</div>
</div>
<?php echo $this->Javascript->getFiles("body");?>
<?php echo $this->Javascript->getInline();?>
<?php echo $this->Html->ifSet($body_end);?>
</body>
</html>
What I don't know of course is how to reference these files in order to create a static page.
I am fine with having Powered By in the footer so is that all I'd need to have for a branded service?
At some point I would like to have a fully blank slate so I can copy HTML generated from my CMS into these templates, which I am guessing is the best way to go to begin with rather than introduce server code from another CMS.