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="<? echo $html->url("/"); ?>" />
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
>
>
>
>
>
>
>
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---