Yup except you missed one point. His problem is that he wants to load
javascript on request when specific partials/templatea are loaded into the
layout, possibly even through ajax requests.

On Thu, Nov 4, 2010 at 11:43 AM, Macvek <mac...@gmail.com> wrote:

> If JS is not generated dynamically and it doesn't generate html
> (document.write) then the best way is to put it in file and refer by
> js helper
> ( use_javascript() ).
>
> Then to run the code, you bind to DOM Load event to execute js. In
> jQuery it is $(document).ready( ... ).
>
> Encapsulating js in file lets browser cache javascript, so the page is
> loaded faster.
>
> Regards,
> Maciej Aleksandrowicz
>
> 2010/11/4 Stéphane <stephane.er...@gmail.com>:
> > Putting javascript tags in the middle of the <body> blocks the
> > loading/computing of the page layout (or something similar).
> > Having a slot to put all JS and echo it at the end or having a stacking
> func
> > to gather all js calls and echo its array at the end (within the layout)
> is
> > quite similar.
> > Regards,
> > Before Printing, Think about Your Environmental Responsibility!
> > Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale!
> >
> >
> > On Thu, Nov 4, 2010 at 9:47 AM, JoJo <jojoyangd...@gmail.com> wrote:
> >>
> >> Hi Alex and Stéphane,
> >>
> >>
> >> Thanks a lot for your suggestion.
> >>
> >> As Gareth said, my concern is how to embed javascript function from
> >> partials between <head></head> tag.
> >>
> >> Because the return of partial will be added at the place where it is
> >> called, so the js functions are added in the middle of layout, it isn't
> >> clean.
> >>
> >> The use of slot for this purpose should be a good idea, i havn't tried
> it,
> >> i will keep you in contact later.
> >>
> >> Any suggestion is welcomed,
> >>
> >> Best Regards,
> >>
> >>
> >> JoJo
> >>
> >> 2010/11/3 Gareth McCumskey <gmccums...@gmail.com>
> >>>
> >>> His one concern is having javascript included in the middle of HTML
> >>> isntead of all at the end of the html. This tactic would still insert
> the
> >>> javascript in the middle of everything.
> >>>
> >>> On Wed, Nov 3, 2010 at 12:57 PM, Alex Pilon <alex.pi...@gmail.com>
> wrote:
> >>>>
> >>>> You could also put that js into external js files and use
> use_javascript
> >>>> to have each partial include the related external js file when it
> loads into
> >>>> the template.
> >>>>
> >>>> On Wed, Nov 3, 2010 at 05:58, Gareth McCumskey <gmccums...@gmail.com>
> >>>> wrote:
> >>>>>
> >>>>> Forgot the
> >>>>> link:
> http://www.symfony-project.org/gentle-introduction/1_4/en/07-Inside-the-View-Layer#chapter_07_sub_slots
> >>>>>
> >>>>> On Wed, Nov 3, 2010 at 11:55 AM, JoJo <jojoyangd...@gmail.com>
> wrote:
> >>>>>>
> >>>>>> Hello everyone,
> >>>>>>
> >>>>>> I have a question not very technical but quite structural.
> >>>>>>
> >>>>>> In my modules, I use some partials to complete the layout. And in
> >>>>>> these partials, I use some javascript functions. So when page
> loaded, these
> >>>>>> javascript functions are added in the middle of template.
> >>>>>>
> >>>>>> I think that it is not very clean do display js in that way, because
> >>>>>> normally they should be added between <head></head>, but these js
> functions
> >>>>>> are spécificaly for its partials and in several js functions, i need
> the
> >>>>>> objects passed from action or component.
> >>>>>>
> >>>>>> So can anyone suggest what is the best way to implement these
> >>>>>> javascript functions please.
> >>>>>>
> >>>>>> Thanks in advance.
> >>>>>>
> >>>>>> Best Regards,
> >>>>>>
> >>>>>> JoJo
> >>>>>>
> >>>>>> --
> >>>>>> If you want to report a vulnerability issue on symfony, please send
> it
> >>>>>> to security at symfony-project.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<symfony-users%2bunsubscr...@googlegroups.com>
> >>>>>> For more options, visit this group at
> >>>>>> http://groups.google.com/group/symfony-users?hl=en
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> Gareth McCumskey
> >>>>> http://garethmccumskey.blogspot.com
> >>>>> twitter: @garethmcc
> >>>>>
> >>>>> --
> >>>>> If you want to report a vulnerability issue on symfony, please send
> it
> >>>>> to security at symfony-project.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<symfony-users%2bunsubscr...@googlegroups.com>
> >>>>> For more options, visit this group at
> >>>>> http://groups.google.com/group/symfony-users?hl=en
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Alex Pilon
> >>>> (613) 608-1480
> >>>>
> >>>> --
> >>>> If you want to report a vulnerability issue on symfony, please send it
> >>>> to security at symfony-project.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<symfony-users%2bunsubscr...@googlegroups.com>
> >>>> For more options, visit this group at
> >>>> http://groups.google.com/group/symfony-users?hl=en
> >>>
> >>>
> >>>
> >>> --
> >>> Gareth McCumskey
> >>> http://garethmccumskey.blogspot.com
> >>> twitter: @garethmcc
> >>>
> >>> --
> >>> If you want to report a vulnerability issue on symfony, please send it
> to
> >>> security at symfony-project.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<symfony-users%2bunsubscr...@googlegroups.com>
> >>> For more options, visit this group at
> >>> http://groups.google.com/group/symfony-users?hl=en
> >>
> >> --
> >> If you want to report a vulnerability issue on symfony, please send it
> to
> >> security at symfony-project.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<symfony-users%2bunsubscr...@googlegroups.com>
> >> For more options, visit this group at
> >> http://groups.google.com/group/symfony-users?hl=en
> >
> > --
> > If you want to report a vulnerability issue on symfony, please send it to
> > security at symfony-project.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<symfony-users%2bunsubscr...@googlegroups.com>
> > For more options, visit this group at
> > http://groups.google.com/group/symfony-users?hl=en
> >
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.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<symfony-users%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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