ZF2中的资产管理

时间:2013-08-13 06:23:02

标签: zend-framework2

我们如何根据ZF2中的模块管理资产

例如:                 用户模块有特定的js和css

我们如何在用户模块中分配js和css文件路径以在布局中显示它 如   echo this-> inlineScript();

或者我们是否需要依赖像Assetmanager这样的外部模块来完成他的

1 个答案:

答案 0 :(得分:3)

毫无疑问,你会对每个模块都有个人观点(例如index.phtml,add.phtml等)

尝试将这样的条目添加到那些特定于模块的文件中;

    <?php $this->headLink()->appendStylesheet('http://fonts.googleapis.com/css?family=Happy+Monkey');?>
    <?php $this->headLink()->appendStylesheet($this->basePath('User/css/style.css'));?>
    <?php $this->headScript()->appendFile('http://code.jquery.com/jquery-1.4.2.min.js'); ?>
    <?php $this->headScript()->appendFile($this->basePath('User/js/user.js')); ?>