Я использую зенд фреймворк 2.
Это мой layout.phtml
<?php echo $this->doctype(); ?>
<html class="fixed" lang="en">
<head>
<!-- Basic -->
<meta charset="UTF-8">
<?php echo $this->headTitle('Test') ?>
<?php
/* Vendor CSS */
$this->headLink(array(
'rel' => 'shortcut icon',
'type' => 'image/vnd.microsoft.icon',
'href' => $this->basePath() . '/img/favicon.ico'
))
->appendStylesheet($this->basePath() . 'aaaa.css')
->appendStylesheet($this->basePath() . 'bbbb.css');
/* Specific Page Vendor CSS */
$this->headLink()
->appendStylesheet($this->basePath() . 'cccc.css')
->appendStylesheet($this->basePath() . 'dddd.css')
/* Theme CSS */
$this->headLink()
->appendStylesheet($this->basePath() . 'eeee.css');
?>
</head>
<body>
<section class="body">
<?php print $this->render('layout/header') ?>
<div class="inner-wrapper">
<?php print $this->render('layout/left-menu') ?>
<section role="main" class="content-body">
<?php echo $this->content; ?>
</section>
</div>
<?php print $this->render('layout/right-menu') ?>
</section>
<?php
/* Vendor */
$this->headScript()
->appendFile($this->basePath() . 'aaaa.js')
->appendFile($this->basePath() . 'bbbb.js');
/* Specific Page Vendor */
$this->headScript()
->appendFile($this->basePath() . 'cccc.js')
->appendFile($this->basePath() . 'dddd.js);
/* Theme Base, Components and Settings */
$this->headScript()
->appendFile($this->basePath() . 'eeee.js');
?>
</body>
</html>
Этот макет работает нормально. Но в layout.phtml нет необходимости задавать конкретных поставщиков страниц. Он будет меняться вместе с контентом. Поэтому мне нужно переместить часть /* конкретного поставщика страниц */ в соответствующий файл .phtml. После этого мой макет и содержимое должны быть такими.
layout.phtml тип документа(); ?>
<!-- Basic -->
<meta charset="UTF-8">
<?php echo $this->headTitle('Test') ?>
<?php
/* Vendor CSS */
$this->headLink(array(
'rel' => 'shortcut icon',
'type' => 'image/vnd.microsoft.icon',
'href' => $this->basePath() . '/img/favicon.ico'
))
->appendStylesheet($this->basePath() . 'aaaa.css')
->appendStylesheet($this->basePath() . 'bbbb.css');
/* Theme CSS */
$this->headLink()
->appendStylesheet($this->basePath() . 'eeee.css');
?>
</head>
<body>
<section class="body">
<?php print $this->render('layout/header') ?>
<div class="inner-wrapper">
<?php print $this->render('layout/left-menu') ?>
<section role="main" class="content-body">
<?php echo $this->content; ?>
</section>
</div>
<?php print $this->render('layout/right-menu') ?>
</section>
<?php
/* Vendor */
$this->headScript()
->appendFile($this->basePath() . 'aaaa.js')
->appendFile($this->basePath() . 'bbbb.js');
/* Theme Base, Components and Settings */
$this->headScript()
->appendFile($this->basePath() . 'eeee.js');
?>
</body>
</html>
Контент.phtml
/* Specific Page Vendor CSS */
$this->headLink()
->appendStylesheet($this->basePath() . 'cccc.css')
->appendStylesheet($this->basePath() . 'dddd.css')
<h1>This is content of the page</h1>
/* Specific Page Vendor */
$this->headScript()
->appendFile($this->basePath() . 'cccc.js')
->appendFile($this->basePath() . 'dddd.js);
Предположим, что нижние таблицы стилей переопределяют таблицы стилей выше. нижний javascript использует вышеуказанные функции javascript.
Как мне это сделать?