A thing that you might do is to have a "Javascript" module in wich you could
render the needed Js functions. Ofcourse, this is not recomended...

On Thu, Apr 16, 2009 at 7:45 PM, Richtermeister <nex...@gmail.com> wrote:

>
> Hey Ahmed,
>
> look into sfContext::getInstance()->getController()->genUrl
> ($internal_uri, $absolute); to generate the url. That's what's being
> called from within the url_for function, and it's perfectly fine to
> use that within your app code.
>
> Hope this helps,
> Daniel
>
>
> On Apr 16, 4:26 am, Ahmed <ghaliano2...@gmail.com> wrote:
> > Hi paolo ;
> > I have already done this before but my goal is to separate the all my
> > Javascript from templates
> > and use helper in this file .
> > Best regards Ahmed
> >
> > > permuter
> >
> > On 16 avr, 13:09, Paolo Mainardi <paolomaina...@gmail.com> wrote:
> >
> > > Embed this code in a file template and will work :)
> >
> > > On Thu, Apr 16, 2009 at 1:08 PM, Ahmed <ghaliano2...@gmail.com> wrote:
> >
> > > > Hi all :) ,
> > > > I want to use a php function to generate url ( for ajax call) in a js
> > > > file like this :
> >
> > > > <?php Header("content-type: application/x-javascript"); ?>
> > > > $(document).ready(function(){
> > > >        $.ajax({
> > > >          url: "<?php echo url_for('company/step1')?>",
> > > >          success: function(html){
> > > >            $("#step1_container").append(html);
> > > >          }
> > > >        });
> > > > }) ;
> >
> > > > But in the generated code i have a logic error
> > > > $(document).ready(function(){
> > > > 2 $.ajax({
> > > > 3 url: "<br />
> > > > 4<b>Fatal error</b>: Call to undefined function url_for() in <b>....
> > > > \www\web\js\company\home.js.php</b> on line <b>4</b><br />
> >
> > > > How can i resolve this please ?
> >
> > > > [Updated on: Thu, 16 April 2009 12:39]
> >
> > > --
> > > Paolo Mainardi
> >
> > > CTO Twinbit
> > > Blog:http://www.paolomainardi.com
> >
>

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

Reply via email to