-
Notifications
You must be signed in to change notification settings - Fork 39
Layout
Верхний уровень двухуровневого шаблонизатора
"layout" => array(
"path" => PATH_APPLICATION .'/layouts',
"template" => 'index.phtml',
"data" => array(
"title" => "Bluz Framework",
),
"helpersPath" => PATH_APPLICATION .'/layouts/helpers',
"helpers" => array(),
)В большинстве функций аналогичное View:
$this->getLayout()->foo = 'bar';Отключение Layout из контроллера:
$this->useLayout(false);Синтаксис:
<?=$this->breadCrumbs(array $data = [])Установка/получение списка "хлебных крошек":
<?php
// controller
Layout::breadCrumbs([
Layout::ahref('Dashboard', ['dashboard', 'index']),
'ACL'
]);
?>
<!-- layout -->
<ul class="breadcrumb">
<?php if (Layout::breadCrumbs()) foreach (Layout::breadCrumbs() as $crump):?>
<li>
<span class="divider">/</span> <?php echo $crump?>
</li>
<?php endforeach;?>
</ul>Синтаксис:
<?php Layout::headScript(\string $script = null)Добавляет указанный скрипт в стек, дабы в дальнейшем вставить его в тег <head> layout'а, можно вызывать из View. Без параметров возвращает код тега <script> для вставки, и очищает стек.
Если layout отсутствует (это может быть AJAX запрос), то вызов скрипта вернёт код тега <script>:
<!-- layout -->
<head>
<?=Layout::headScript()?>
</head>
<!-- view -->
<?=Layout::headScript('js/jquery.js')?>
<?=Layout::headScript('$.ready(function(){
// la-la-la
})')?>
<!-- result -->
<head>
<script src="js/jquery.js"></script>
<script type="text/javascript">
<!--
$.ready(function(){
// la-la-la
})
//-->
</script>
</head>Синтаксис:
<?php Layout::headStyle(\string $style = null, $media = 'all')Назначение аналогично headScript, но применительно к CSS стилям.
Синтаксис:
<?=Layout::meta(\string $name = null, string $content = null)Добавление meta тегов в тег <head>, если layout отключен, то вернётся пустая строка:
// controller or view
Layout::meta('keywords', $page->keywords);
Layout::meta('description', $page->description);<!-- layout -->
<head>
<?=Layout::meta()?>
</head>Acl
Application
Auth
Cache
Common
— Exception
— Collection
— Container
— Helper
— Options
— Singleton
Config
Controller
— Data
— Mapper
—— Crud
—— Rest
— Reflection
Crud
— Crud Table
Db
— Row
— Table
— Relations
— Query
Debug
EventManager
Grid
Http
Layout
Logger
Mailer
Messages
Nil
Proxy
Registry
Request
Response
Router
Session
Translator
Validator
View