[Zend_Framework] Zend_Layout and Bootstrapping

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
BornForCode
Forum Contributor
Posts: 147
Joined: Mon Feb 11, 2008 1:56 am

[Zend_Framework] Zend_Layout and Bootstrapping

Post 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?
BornForCode
Forum Contributor
Posts: 147
Joined: Mon Feb 11, 2008 1:56 am

Re: [Zend_Framework] Zend_Layout and Bootstrapping

Post by BornForCode »

more then 24 hours bump :)
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: [Zend_Framework] Zend_Layout and Bootstrapping

Post 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?)
BornForCode
Forum Contributor
Posts: 147
Joined: Mon Feb 11, 2008 1:56 am

Re: [Zend_Framework] Zend_Layout and Bootstrapping

Post by BornForCode »

Yep, there is no security breach since the three paths can be found in my public folder :)
Post Reply