views:

41

answers:

2

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?

A: 

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:

In HTML the tag has no end tag.

In XHTML the tag must be properly closed.

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.

Iznogood
But then, as soon as I upload it to my host, for example, it won't work, making it not portable
Rodrigo Alves
Is there any way to get the baseUrl in the bootstrap? 'cause even fixing the `base`tag, IE still doesn't work
Rodrigo Alves
A: 

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/
hunterman
What if I'm setting this in the Bootstrap? `$this->baseUrl()` doesn't work. It says: `Zend_Application_Bootstrap_Exception: Invalid method "baseUrl"`
Rodrigo Alves
if you use it in Bootstrap you can set baseUrl via config - resources.frontController.baseUrl = /test/
hunterman