Please refer text below link

http://www.symfony-project.org/book/1_2/07-Inside-the-View-Layer

=========================================================
File Inclusion Configuration
Adding a specific style sheet or JavaScript file to a view is easy, as
Listing 7-26 demonstrates.

Listing 7-26 - Asset File Inclusion

// In the view.yml
indexSuccess:
  stylesheets: [mystyle1, mystyle2]
  javascripts: [myscript]

[php]
// In the Action
$this->getResponse()->addStylesheet('mystyle1');
$this->getResponse()->addStylesheet('mystyle2');
$this->getResponse()->addJavascript('myscript');

// In the Template
<?php use_stylesheet('mystyle1') ?>
<?php use_stylesheet('mystyle2') ?>
<?php use_javascript('myscript') ?>

In each case, the argument is a file name. If the file has a logical
extension (.css for a style sheet and .js for a JavaScript file), you
can omit it. If the file has a logical location (/css/ for a style
sheet and /js/ for a JavaScript file), you can omit it as well.
Symfony is smart enough to figure out the correct extension or
location.
===========================================================


On 6/1/09, Gábor Fási <maerl...@gmail.com> wrote:
>
> Put it in the global js folder, and use the modules view.yml to
> include it in the templates that need it.
>
> On Mon, Jun 1, 2009 at 18:01, Mark Smith
> <marksmith5...@jungle-monkey.com> wrote:
> >
> > If I am writing some page specific javascript where should I put it?
> >
> > The way I see it I have 3 options:
> >
> > 1) Embed it in the page template (feels very hacky)
> >
> > 2) Stick it in a global .js and load it every time regardless. (could
> > cause problems and isn't really scalable)
> >
> > 3) Put it in its own .js file in the web folder and add it to the view
> > (again seems like it would be hard to manage, but feels slightly less
> > evil than the first 2 options)
> >
> > Are there other options I haven't considered?
> >
> > What do you do?
> >
> > Thanks
> > >
> >
>
> >
>

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