如何从Zend Framework 1中的模块加载CSS和javascript文件? [英] how to load css and javascript files from a module in Zend Framework 1?

查看:66
本文介绍了如何从Zend Framework 1中的模块加载CSS和javascript文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有休闲结构

/app
    application/
        configs/
        modules/
             default/
                   controllers/
                   layouts/
                   views/
                   forms/
             profile/
                   controllers/
                   layouts/
                   views/
                   forms/
                   assets/
                       css/
                       js/
                       images/
    library/
    public/
        css/
        js/
        images/
        uploads/

如何从

/application/modules/profile/assets/...?

并使用与

$this->view->headLink()->appendStylesheet('path/to/file');

关于这个问题有什么想法吗?

any ideas on this issue?

推荐答案

The HeadLink view helper only manages the references to CSS files which are rendered in the section of your HTML page. These stylesheets should have always have a public URL, which means that they'll have to reside somewhere in the 'public' folder.

一种解决方案是仅将CSS文件移动到此处.另一个解决方案是拥有某种PHP脚本,该脚本从"public"文件夹之外的位置读取CSS文件,然后打印其中的内容. Zend Framework对此没有标准组件,因此我建议重新组织项目,以便所有CSS都可以驻留在"public"文件夹中的某个位置.

One solution would be to just move the CSS files there. Another solution would be tohave some kind of PHP script which reads the CSS files from the location outside the 'public' folder and then prints the content of it. Zend Framework does not have a standard component for this though, so I would recommend to reorganise the project, so all the CSS can reside somewhere in the 'public' folder.

这篇关于如何从Zend Framework 1中的模块加载CSS和javascript文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆