You need to use base_path()<br>e.g., <?php print base_path() . path_to_theme(). '/images/whatever.gif' ?><br><br>In the first case, using l() or url() should be it, would you post an example wrong link being generated out of them?
<br><br>Cheers,<br><br><div><span class="gmail_quote">On 4/23/07, <b class="gmail_sendername">Ashraf Amayreh</b> <<a href="mailto:firstname.lastname@example.org">email@example.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello all,<br><br>Don't know if this is the best place for this, so if it's already discussed elsewhere, I'll be thankful if you could point me to the URL cause I couldn't find anything myself. I'm really having a tough time when creating URLs to other parts of a Drupal site. Especially when I'm using clean URLs and even more when I have Drupal as a subfolder like
<a href="http://example.com/mydrupalsite" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://example.com/mydrupalsite</a> (in which case the internal node page could be something like <a href="http://example.com/drupal/node/5" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
<br>As far as I've noticed, there are three cases of referencing, this is how I do it, but I'm positive that there's something wrong or else I wouldn't get broken links and/or images when I toggle clean-urls on and off and when I have my site as a domain opposed to a subfolder:
<br><br>1. Referencing another page, in this case I use l() or url() with relative paths to get the link<br>2. Referencing a file in the themes folder in which case I use src="<?php print path_to_theme().'/images/whatever.gif';?>
<br>3. Referencing a file in the files folder in which case I use href="<?php print file_directory_path().'/whatever.zip';?><br><br>The main headache cause is the second one. If I have clean URLs on and the site as a domain (
<a href="http://example.com/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://example.com/</a>) then the paths are wrong on node pages.<span style="font-family: monospace;"></span> Although this may be a bug or something, I need to know the standard way of referencing any and all paths before I jump to conclusions. Would be grateful if someone could shed the light on this :-)