Hi Felix
 my img path is my js code not html...
And? The HtmlHelper::url() function just outputs a path, no html at all.

" 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 ?
Yes, it would.



Olivier Percebois-Garve schrieb:
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



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

Reply via email to