IE 中的 baseURL 修复
我正在开发一个具有以下结构的网站:单击此处。我在尝试加载样式表时遇到了一些 URL 问题。更具体地说,在 admin 模块中,我正在使用此引导程序:
<?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');
}
}
此外,我正在使用 有没有其他方法可以在引导程序中附加我的资源,或者我确实需要解决方法?这应该如何? 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: Also I'm using Is there any other way to append my resources in the bootstrap or I do need to workaround? How this should be? 由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!/ccgss/admin/
作为 baseUrl 而不是 /ccgss/
当尝试加载 public
文件夹中的内容时会导致问题,因为它尝试在 /ccgss/admin/public
中查找。<?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');
}
}
<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
.如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
尝试设置这样的路径:
也尝试使用谷歌的jquery存储: 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:我的应用程序使用插件来加载此类库,我发现它对我来说非常有用:
try to set paths like that:
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:
一种简单的解决方案是在这些路径前面加一个斜杠,这将使它们成为您网站根目录的绝对路径。
也来自此处:
因此,请确保设置正确的文档类型。
另外为什么你的index.php不在公共文件夹中?您知道公用文件夹实际上是许多服务器上的 public_html 文件夹。
One easy solution would be to put a slash in front of those path wich would make them absolute to your websites root.
also from here:
So make sure you set the right doctype.
Also why is your index.php not in the public folder? You know that the public folder really is the public_html folder on a lot of servers.