Zend框架和Ext-Js4,文件和文件夹结构

发布于 2025-01-08 05:15:21 字数 566 浏览 2 评论 0原文

我正在尝试将 Zend Frame work 和 Ext-Js4 一起使用。

但我不知道如何正确设置文件和文件夹结构。

我这样设置,

在此处输入图像描述

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');

是它的结构正确吗?有人有更好的主意吗?

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

人海汹涌 2025-01-15 05:15:21

如果您在整个应用程序中使用 Ext-Js4,更好的主意是将其添加到 bootstap 中,这样您就不必在每个控制器中包含 javascript 路径。

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;
}

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;
}
从来不烧饼 2025-01-15 05:15:21

我倾向于使用这样的布局:

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');
}

然后在我的 application.ini 文件中我包括:

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

总是有更多的方法来给众所周知的猫剥皮!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文