Reputation: 10624
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,
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
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
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