Page 1 of 1

[Zend_Framework] Zend_Layout and Bootstrapping

Posted: Mon Jun 29, 2009 5:40 pm
by BornForCode
Hello,

It is correct to do this:

Code: Select all

 
<html> 
    <head>     
        <?php 
            $bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');             
             
            $view = $bootstrap->getResource('View'); 
            $request = $bootstrap->getResource('FrontController')->getRequest(); 
             
             
             $this->headTitle($view->title); 
             $this->headTitle()->setSeparator(' / '); 
             $this->headTitle($request->getActionName()) 
                  ->headTitle($request->getControllerName()); 
              
             echo $this->headTitle(); 
             
            $this->headScript()->appendFile($view->pathCss.'javascript.js'); 
            echo $this->headScript();             
             
            $this->headStyle()->appendStyle($view->pathCss.'style.css'); 
            echo $this->headStyle(); 
        ?> 
         
    </head> 
    <body> 
        <?php echo $this->layout()->content; ?> 
    </body> 
</html>
 
In my config i have:

Code: Select all

 
resources.view.params.title                                        = "My application" 
resources.view.params.pathCss                                   = "/public/css/" 
resources.view.params.pathImg                                   = "/public/img/" 
resources.view.params.pathJs                                    = "/public/js/" 
resources.view.params.doctype                                   = "HTML4_STRICT" 
resources.view.params.charset                                   = "utf-8" 
 

If is not correct, can you please give me a different approach?

Re: [Zend_Framework] Zend_Layout and Bootstrapping

Posted: Wed Jul 01, 2009 3:40 am
by BornForCode
more then 24 hours bump :)

Re: [Zend_Framework] Zend_Layout and Bootstrapping

Posted: Wed Jul 01, 2009 3:47 am
by requinix
You can do whatever you want. If it works.

The thing about Zend Framework is that it's too generic. There are a billion ways of doing something because ZF is built to work with every kind of application. Which (in my opinion) is a bad thing, leading to questions like the one you have.

As I said: if it works...

(PS: You really want /public in those three paths?)

Re: [Zend_Framework] Zend_Layout and Bootstrapping

Posted: Wed Jul 01, 2009 9:13 am
by BornForCode
Yep, there is no security breach since the three paths can be found in my public folder :)