[symfony-users] Re: How can i use a symfony helper in a js file

2009-04-21 Thread ctrlming

you can use it in  JavascriptHelper.php : javascript_tag(' ');


I used it in my jQueryHelper called jq_javascript_tag(''); looks like
JavascriptHelper javascript_tag();
My English not good,I hope you can read these words

On 4月16日, 下午7时08分, Ahmed  wrote:
> Hi all :) ,
> I want to use a php function to generate url ( for ajax call) in a js
> file like this :
>
> 
> $(document).ready(function(){
> $.ajax({
>   url: "",
>   success: function(html){
> $("#step1_container").append(html);
>   }
> });
>
> }) ;
>
> But in the generated code i have a logic error
> $(document).ready(function(){
> 2 $.ajax({
> 3 url: "
> 4Fatal error: Call to undefined function url_for() in 
> \www\web\js\company\home.js.php on line 4
>
> How can i resolve this please ?
>
> [Updated on: Thu, 16 April 2009 12:39]
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[symfony-users] Re: How can i use a symfony helper in a js file

2009-04-21 Thread Ido

Could you elaborate ?
what helper ? where are you calling it from ?

10x

On Apr 17, 9:13 pm, Ahmed  wrote:
> Thanks for all;
> After many search i found that the best way is doing this with
> helper .
> @Alexandru-Emil Lupu : Why it's not recomended ?
>
> On 17 avr, 08:50, Alexandru-Emil Lupu  wrote:
>
> > 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  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  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  wrote:
>
> > > > > Embed this code in a file template and will work :)
>
> > > > > On Thu, Apr 16, 2009 at 1:08 PM, Ahmed  wrote:
>
> > > > > > Hi all :) ,
> > > > > > I want to use a php function to generate url ( for ajax call) in a 
> > > > > > js
> > > > > > file like this :
>
> > > > > > 
> > > > > > $(document).ready(function(){
> > > > > >        $.ajax({
> > > > > >          url: "",
> > > > > >          success: function(html){
> > > > > >            $("#step1_container").append(html);
> > > > > >          }
> > > > > >        });
> > > > > > }) ;
>
> > > > > > But in the generated code i have a logic error
> > > > > > $(document).ready(function(){
> > > > > > 2 $.ajax({
> > > > > > 3 url: "
> > > > > > 4Fatal error: Call to undefined function url_for() in 
> > > > > > \www\web\js\company\home.js.php on line 4
>
> > > > > > 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
-~--~~~~--~~--~--~---



[symfony-users] Re: How can i use a symfony helper in a js file

2009-04-17 Thread Jonathan Wage
I've used modules and actions to serve dynamic js files all the time. Just
make sure you turn on caching if you can and make sure the right headers are
sent for js files so that they are cached in the users browser.

- Jon

On Fri, Apr 17, 2009 at 1:13 PM, Ahmed  wrote:

>
> Thanks for all;
> After many search i found that the best way is doing this with
> helper .
> @Alexandru-Emil Lupu : Why it's not recomended ?
>
> On 17 avr, 08:50, Alexandru-Emil Lupu  wrote:
> > 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 
> 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  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  wrote:
> >
> > > > > Embed this code in a file template and will work :)
> >
> > > > > On Thu, Apr 16, 2009 at 1:08 PM, Ahmed 
> wrote:
> >
> > > > > > Hi all :) ,
> > > > > > I want to use a php function to generate url ( for ajax call) in
> a js
> > > > > > file like this :
> >
> > > > > > 
> > > > > > $(document).ready(function(){
> > > > > >$.ajax({
> > > > > >  url: "",
> > > > > >  success: function(html){
> > > > > >$("#step1_container").append(html);
> > > > > >  }
> > > > > >});
> > > > > > }) ;
> >
> > > > > > But in the generated code i have a logic error
> > > > > > $(document).ready(function(){
> > > > > > 2 $.ajax({
> > > > > > 3 url: "
> > > > > > 4Fatal error: Call to undefined function url_for() in
> 
> > > > > > \www\web\js\company\home.js.php on line 4
> >
> > > > > > How can i resolve this please ?
> >
> > > > > > [Updated on: Thu, 16 April 2009 12:39]
> >
> > > > > --
> > > > > Paolo Mainardi
> >
> > > > > CTO Twinbit
> > > > > Blog:http://www.paolomainardi.com
> >
> >
> >
>


-- 
Jonathan H. Wage
Open Source Software Developer & Evangelist
http://www.jwage.com
http://www.doctrine-project.org
http://www.symfony-project.org

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



[symfony-users] Re: How can i use a symfony helper in a js file

2009-04-17 Thread Ahmed

Thanks for all;
After many search i found that the best way is doing this with
helper .
@Alexandru-Emil Lupu : Why it's not recomended ?

On 17 avr, 08:50, Alexandru-Emil Lupu  wrote:
> 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  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  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  wrote:
>
> > > > Embed this code in a file template and will work :)
>
> > > > On Thu, Apr 16, 2009 at 1:08 PM, Ahmed  wrote:
>
> > > > > Hi all :) ,
> > > > > I want to use a php function to generate url ( for ajax call) in a js
> > > > > file like this :
>
> > > > > 
> > > > > $(document).ready(function(){
> > > > >        $.ajax({
> > > > >          url: "",
> > > > >          success: function(html){
> > > > >            $("#step1_container").append(html);
> > > > >          }
> > > > >        });
> > > > > }) ;
>
> > > > > But in the generated code i have a logic error
> > > > > $(document).ready(function(){
> > > > > 2 $.ajax({
> > > > > 3 url: "
> > > > > 4Fatal error: Call to undefined function url_for() in 
> > > > > \www\web\js\company\home.js.php on line 4
>
> > > > > 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
-~--~~~~--~~--~--~---



[symfony-users] Re: How can i use a symfony helper in a js file

2009-04-16 Thread Alexandru-Emil Lupu
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  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  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  wrote:
> >
> > > Embed this code in a file template and will work :)
> >
> > > On Thu, Apr 16, 2009 at 1:08 PM, Ahmed  wrote:
> >
> > > > Hi all :) ,
> > > > I want to use a php function to generate url ( for ajax call) in a js
> > > > file like this :
> >
> > > > 
> > > > $(document).ready(function(){
> > > >$.ajax({
> > > >  url: "",
> > > >  success: function(html){
> > > >$("#step1_container").append(html);
> > > >  }
> > > >});
> > > > }) ;
> >
> > > > But in the generated code i have a logic error
> > > > $(document).ready(function(){
> > > > 2 $.ajax({
> > > > 3 url: "
> > > > 4Fatal error: Call to undefined function url_for() in 
> > > > \www\web\js\company\home.js.php on line 4
> >
> > > > 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
-~--~~~~--~~--~--~---



[symfony-users] Re: How can i use a symfony helper in a js file

2009-04-16 Thread Richtermeister

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  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  wrote:
>
> > Embed this code in a file template and will work :)
>
> > On Thu, Apr 16, 2009 at 1:08 PM, Ahmed  wrote:
>
> > > Hi all :) ,
> > > I want to use a php function to generate url ( for ajax call) in a js
> > > file like this :
>
> > > 
> > > $(document).ready(function(){
> > >        $.ajax({
> > >          url: "",
> > >          success: function(html){
> > >            $("#step1_container").append(html);
> > >          }
> > >        });
> > > }) ;
>
> > > But in the generated code i have a logic error
> > > $(document).ready(function(){
> > > 2 $.ajax({
> > > 3 url: "
> > > 4Fatal error: Call to undefined function url_for() in 
> > > \www\web\js\company\home.js.php on line 4
>
> > > 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
-~--~~~~--~~--~--~---



[symfony-users] Re: How can i use a symfony helper in a js file

2009-04-16 Thread Ahmed

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  wrote:
> Embed this code in a file template and will work :)
>
>
>
> On Thu, Apr 16, 2009 at 1:08 PM, Ahmed  wrote:
>
> > Hi all :) ,
> > I want to use a php function to generate url ( for ajax call) in a js
> > file like this :
>
> > 
> > $(document).ready(function(){
> >        $.ajax({
> >          url: "",
> >          success: function(html){
> >            $("#step1_container").append(html);
> >          }
> >        });
> > }) ;
>
> > But in the generated code i have a logic error
> > $(document).ready(function(){
> > 2 $.ajax({
> > 3 url: "
> > 4Fatal error: Call to undefined function url_for() in 
> > \www\web\js\company\home.js.php on line 4
>
> > 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
-~--~~~~--~~--~--~---



[symfony-users] Re: How can i use a symfony helper in a js file

2009-04-16 Thread Paolo Mainardi
Embed this code in a file template and will work :)

On Thu, Apr 16, 2009 at 1:08 PM, Ahmed  wrote:

>
> Hi all :) ,
> I want to use a php function to generate url ( for ajax call) in a js
> file like this :
>
> 
> $(document).ready(function(){
>$.ajax({
>  url: "",
>  success: function(html){
>$("#step1_container").append(html);
>  }
>});
> }) ;
>
>
> But in the generated code i have a logic error
> $(document).ready(function(){
> 2 $.ajax({
> 3 url: "
> 4Fatal error: Call to undefined function url_for() in 
> \www\web\js\company\home.js.php on line 4
>
> 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
-~--~~~~--~~--~--~---