[development] Multi-site absolute paths?

Sam Tresler sam at treslervania.com
Wed Sep 20 01:29:25 UTC 2006


Larry Garfield wrote:
> I've had some issues with multi-site recently myself, but this isn't one of 
> them.  What exactly is the problem with absolute paths generated by the code 
> having long names?  You aren't typing them yourself, or shouldn't be.
>
> Perhaps the obvious thing being missed is that it's not a problem?  Or am I 
> just not seeing how it's a problem? :-)  (I typically put all files under 
> sites anyway, and in 5.0 the new sites/all directory encourages you do never 
> ever put things in /modules or /themes.)
>
>   

Ahh, didn't know that about 5.0  - good stuff.

Why shouldn't I be typing them myself?  In many cases they are generated 
by drupal, but I usually use absolute paths to reference images in CSS, 
which I thought was a good practice to be browser compliant with some 
older browsers that still reference CSS off of the calling document (not 
w3c, but they do exist). 

Also, knowing nothing about javascript, I've had at least one theme 
break trying to reference a .js file from sites/example.com/themes on a 
relative path meant for the global theme directory.  In page.tpl.php:

"<script type="text/javascript" 
src="/themes/sometheme/sometheme.js"></script>"

I changed to this:

"<script type="text/javascript" src="<?php print base_path(); 
?>sites/example.com/themes/sometheme/sometheme.js"></script>"

I guess what I'm asking is, Is this right? I wouldn't think I should 
hardcode the site into the page.tpl.php just to get it to work in the 
site specific theme folder.
What is the proper way to make CSS image paths, and reference javascript 
in themes? 


--Sam Tresler
sam at treslerdesigns.com


More information about the development mailing list