|
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 Olivier Percebois-Garve schrieb: Hi I've that little annoying issue: usually the url is : 1)controller/action/params but can be: 2)controller/actionin 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 -~----------~----~----~----~------~----~------~--~--- |
- Best way to handle url variations in js and css fi... Olivier Percebois-Garve
- Re: Best way to handle url variations in js a... Felix Geisendörfer
- Re: Best way to handle url variations in ... Olivier Percebois-Garve
- Re: Best way to handle url variations... Felix Geisendörfer
- Re: Best way to handle url variat... Olivier Percebois-Garve
- Re: Best way to handle url variations... clemos
- Re: Best way to handle url variat... Olivier Percebois-Garve
- Re: Best way to handle url v... clemos
- Re: Best way to handle u... Olivier Percebois-Garve
