The shell design zendframework
I 'm facing a problem with my implementation of my shell . The first
public folders I have created . Then wrote the following code skin.xml .
enter code here
<? xml version = "1.0" encoding = "UTF-8"?>
<skin>
<stylesheets>
<stylesheet> layout.css </ stylesheet>
<stylesheet> text.css </ stylesheet>
</ stylesheets>
</ skin>
And so I wrote the CSS file and folder application -> views-> helper file
named LoadSkin.php I wrote this code inside
enter code here
<? php
/ **
* This class loads the cms skin
*
* /
class Zend_View_Helper_LoadSkin extends Zend_View_Helper_Abstract
{
public function loadSkin ($ skin)
{
/ / Load the skin config file
$ skinData = new Zend_Config_Xml ('. / skins /'. $ skin. '/ skin.xml');
$ stylesheets = $ skinData-> stylesheets-> stylesheet-> toArray ();
/ / Append each stylesheet
if (is_array ($ stylesheets)) {
foreach ($ stylesheets as $ stylesheet) {
$ this-> view-> headLink () -> appendStylesheet ('/ skins /'. $ skin.
'/ css /'. $ stylesheet);
{
{
{
{
I put the following code in bootstrap.php file .
enter code here
protected function _initView ()
{
/ / Initialize view
$ view = new Zend_View ();
$ view-> doctype ('XHTML1_STRICT');
$ view-> headTitle ('Zend CMS');
$ view-> skin = 'blues';
/ / Add it to the ViewRenderer
$ viewRenderer = Zend_Controller_Action_HelperBroker :: getStaticHelper (
'ViewRenderer'
) ;
$ viewRenderer-> setView ($ view);
/ / Return it, so that it can be stored by the bootstrap
return $ view;
{
In the following code I layout.phtml file .
enter code here
$ this-> loadSkin ($ this-> skin);
However when I test the project does not work . Enter the text displayed
by the shell without any error but not displayed . What is the reason ? I
am using the book Pro Zend Framework Techniques Build a Full CMS Project
(Forrest Lyman) This book uses the zf1 or zf2? I did not have any previous
experience in this field.
No comments:
Post a Comment