In your layout file between the head tags: <?php if ($sf_user->hasCredentials(...)): ?> <?php use_javascript(...) ?> <?php endif ?>
On Fri, Oct 23, 2009 at 1:27 PM, Konrad Korzeniowski <[email protected]>wrote: > Hi, > > by "include" I meant: > <head> > <script type="text/javascript" src="/js/scriptA.js"></script> > <script type="text/javascript" src="/js/scriptB.js"></script> > </head> > > in my module/action/config/view.yml I got: > default: > javascripts: [scriptA.js] > > and that is ok, I need this for not authorized/authenticated users > (<script> tag is generated properly) > > Is there any way to add script tag in head for: > - specific js file (scriptB.js) > - authenticated user (I'm not using defined credentials/roles) > - after script tags included by module/action/config/view.yml::javascripts > (those are only libs) > - preferably not modifing front/templates/layout.php > ?? > > Problem occurs when I put scriptA.js in > module/action/config/view.yml::javascripts , someone goes to the > path requiring authentication (eg. http://host/module/action), gets logon > form but there are js > errors - function (onload) in the script is trying to access DOM element > which doesn't exists > (its part of indexSuccess of module/action and not logon form). > > Thx for your patience :-) > > rgrds., > KK > > > > [2009-10-23 00:42] Alexandre SALOME: > > In your template : > > <?php if ($sf_user->hasCredentials(...)): ?> > <?php use_javascript(...) ?> > <?php endif ?> > > 2009/10/21 Konrad <[email protected]> > >> >> Hi, >> >> does anybody know how to include specific js script (file) for >> specific module/action only for authorized users in a nice/proper way? >> >> thx in advance. >> Konrad >> >> >> > > > -- > Alexandre Salomé -- [email protected] > > > > > > > -- Gareth McCumskey http://garethmccumskey.blogspot.com twitter: @garethmcc --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
