dongping4461 2010-09-02 17:55
浏览 55
已采纳

在IE中修复baseURL

I'm developing a website with following structure: click here. And I'm having some problems with the URL when trying to load stylesheets. Being more specific, in the admin module I'm using this bootstrap:

<?php

class Admin_Bootstrap extends Zend_Application_Module_Bootstrap
{
    public function _initResources() {
        $view = new Zend_View();
        $view->headScript()
                ->appendFile('public/js/jquery-1.4.2.min.js')
                ->appendFile('public/js/jquery.tools.min.js')
                ->appendFile('public/js/jquery-ui-1.8.4.custom.min.js')
                ->appendFile('public/js/utils.js')
                ->appendFile('public/ckeditor/ckeditor.js')
                ->appendFile('public/ckeditor/adapters/jquery.js')
                ->appendFile('public/js/admin.js')
                ->appendFile('public/js/ie.utils.js', null, array('conditional' => 'IE'))
                ->appendFile('public/js/ie.js', null, array('conditional' => 'IE'));

        $view->headLink()
                ->appendStylesheet('public/css/blueprint/screen.css', 'screen')
                ->appendStylesheet('public/css/uploadify.css', 'screen')
                ->appendStylesheet('public/css/jquery.tools.css', 'screen')
                ->appendStylesheet('public/css/ui-theme/jquery-ui-1.8.4.custom.css', 'screen')
                ->appendStylesheet('public/css/blueprint/print.css', 'print')
                ->appendStylesheet('public/css/admin.css', 'screen')
                ->appendStylesheet('public/css/blueprint/ie.css', 'screen', 'IE')
                ->appendStylesheet('public/css/ie.css', 'screen', 'IE');
    }

}

Also I'm using <base href="<?php echo $this->baseUrl(); ?>/" /> which works perfectly for Chrome and Firefox, but in IE I could see that the <base> TAG doesn't work and it uses /ccgss/admin/ as baseUrl instead of /ccgss/ which cause problem when trying to load something in the public folder 'cause it tries to find in /ccgss/admin/public.

Is there any other way to append my resources in the bootstrap or I do need to workaround? How this should be?

  • 写回答

2条回答 默认 最新

  • douqiang5933 2010-09-05 05:52
    关注

    try to set paths like that:

     $view->headScript()
                    ->appendFile($this->baseUrl() . 'public/js/jquery-1.4.2.min.js');
    

    also try to use google's jquery store: http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js

    ps: http://code.google.com/intl/en-En/apis/libraries/devguide.html

    pss: in my application I use plugins for loading such libraries and I found that it is very useful property for me:

    resources.frontController.baseUrl = /test/
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测