Friday, January 22, 2010

Re: Relative URL for Javascript

Hi,

Thanks! Nice trick. So, problem technically solved but still, why the
urls are not relative in Javascript with Cake? Is it a Cake problem or
something else?

On Jan 20, 4:29 pm, Akeda Bagus <ad...@gedex.web.id> wrote:
> On Wed, Jan 20, 2010 at 10:16 PM, thomaus <tho...@saimiris.com> wrote:
> > Anybody a clue?
>
> > On Jan 19, 10:28 am, thomaus <tho...@saimiris.com> wrote:
> >> Hi,
>
> >> In my Javascript, I need to use full paths (e.g.http://localhost/MySite/controller/action)
> >> instead of relative URLs (e.g. controller/action), otherwise the
> >> actions calls they don't work.
>
> >> Is there something I can do about that?
>
> in your controller:
> $this->set('path', 'var path = "' . $this->webroot . '/' .
> $this->params['controller'] . '/' . $this->params['actions'] . '";';
>
> in your view:
> echo $javascript->codeBlock($path);
>
> --
> regards,
> gedex
>
> blog:http://gedex.web.id

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: