[development] Multi-site absolute paths?

Larry Garfield larry at garfieldtech.com
Wed Sep 20 02:09:00 UTC 2006


On Tuesday 19 September 2006 20:29, Sam Tresler wrote:

> 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).

Drupal doesn't support Netscape 4 anyway, so I wouldn't bother with that. :-)

> 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?

This is what you're looking for:
http://api.drupal.org/api/4.7/function/path_to_theme

<script type="text/javascript" src="<?php print 
path_to_theme();?>/sometheme.js"></script>

-- 
Larry Garfield			AIM: LOLG42
larry at garfieldtech.com		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson


More information about the development mailing list