On 6/9/06, Olivier Percebois-Garve <[EMAIL PROTECTED]> wrote:
Yes Initially I did not want to play with the layout file because my js is
not set from there (I uses Head helper)
then, to put a <base /> in your <head>, I think you can just :
$head->register_raw("<base href="" />);
yet I would personnaly find it less convenient because anyway, your
base href is _always_ the cake base url, isn't it?
I didn't try it, so I don't know if this works, but I think it's the
simplest solution.
++++++
clemos
but it could be handy. I must think about it.
clemos wrote:
hi all
maybe something you could do is set some _javascript_ var in your html
code like this :
<script>
baseUrl = "<? echo $html->url("/"); ?>";
</script>
and then prefix all your pics' urls with baseUrl in your external .js
or maybe put something like this :
<base href=""/"); ?>" />
in your layout, and then make all your urls relative.
this second solution could probably work with both css, js...
I actually didn't try, but it's the most clever things I can think of
++++++
clemos
ps: by the way, the things are getting a bit more complicated when you
(at least : I) can't use .htaccess, because $html->url('/') will be
"/absolute/path/index.php/" and relative urls will be
"/absolute/path/index.php/relative/url/pic.gif", which
won't work...
any thoughts about it ?
On 6/9/06, Olivier Percebois-Garve <[EMAIL PROTECTED]> wrote:
Hi Felix
my img path is my js code not html...
" You could also rename your js file to php to execute the php directly
inside of it"
Will it then be served as a js ?
Olivvv
Felix Geisendörfer wrote:
You need to make use of the $html->url() function to create the path's to
your images. In your case I'd put this in the <head> part of your layout:
<script language="_javascript_">
var myImageUrl = '<?php echo
$html->url('/img/myfolder/myimage.png') ?>';
</script>
You could also rename your js file to php to execute the php directly
inside of it. Or put an .htaccess into you /js/ folder that redirects all
requests a an includer.php which will then do include() on the .js file,
making it parsed via php.
Hope that helps,
Felix aka the_undefined
--------------------------
http://www.thinkingphp.org
http://www.fg-webdesign.de
Olivier Percebois-Garve schrieb:
Hi
I've that little annoying issue:
usually the url is :
1)controller/action/params
but can be:
2)controller/action
in my _javascript_ I play with images
"url(../../img/myfolder/myimage.png)";
no problem in cas 1) but in case 2) it will be broken.
How do you handle such things ?
thanks
olivvv
>
>