Expert wanna be
Expert wanna be

Reputation: 10624

Zend framework and Ext-Js4, file and folder structure

I am trying to use Zend Frame work and Ext-Js4 together.

But I don't know how to setup file and folder structure correctly.

I setup like this,

enter image description here

And in application/controllers/IndexController.php

$this->view->headScript()->appendFile('/js/ext-4.0.7/ext-all.js','text/javascript');
$this->view->headScript()->appendFile('/js/app.js','text/javascript');
$this->view->headLink()->appendStylesheet('/js/ext-4.0.7/resources/css/ext-all.css');

Is it right structure? anyone has a better idea?

Thank you.

Upvotes: 0

Views: 768

Answers (2)

David Christensen
David Christensen

Reputation: 11

I tend to use a layout for things like this:

function _initViewHelpers()
{
    $this->bootstrap('layout');
    $layout = $this->getResource('layout');
    $view = $layout->getView();

    $view->doctype('HTML4_STRICT');
    $view->headMeta()->appendHttpEquiv('Content-type', 'text/html;charset=utf-8')
                     ->appendName('description', 'My App');

    $view->headTitle()->setSeparator(' - ')
                      ->headTitle('My App');
}

Then in my application.ini file I include:

resources.view[] =
resources.layout.layoutPath = APPLICATION_PATH "/layouts

There are always more ways to skin the proverbial cat!

Upvotes: 1

Liyali
Liyali

Reputation: 5693

If you're using Ext-Js4 in your entire application, a better idea would be to add this in your bootstap, so that you don't have to include your javascript paths in every controllers.

protected function _initView()
{
    $view = new Zend_View();
    $view->headScript()->appendFile('/js/ext-4.0.7/ext-all.js','text/javascript');
    $view->headScript()->appendFile('/js/app.js','text/javascript');
    $view->headLink()->appendStylesheet('/js/ext-4.0.7/resources/css/ext-all.css');
    $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
    $viewRenderer->setView($view);
    return $view;
}

Upvotes: 1

Related Questions