I don't see why this would be an issue, if you've always used variables within PHP to determine javascript file inclusion in Smarty, why not do the same for javascript written using jQuery?
- jake On 2/14/07, Chris Scott <[EMAIL PROTECTED]> wrote: > Mike Alsup wrote: > >> Sticking it in the template file would mean putting the > >> script block outside the head which I don't really want. > > > > Why does it mean that? I put all that stuff in the template like this: > > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> > > <head> > > <script type="text/javascript" src="js/jquery-pack.js"></script> > > <script type="text/javascript"> > > {literal} > > $(function() { > > $('div.round').corner(); > > }); > > {/literal} > > </script> > > {if $googleMaps} > > <script type="text/javascript" src="js/jquery.googlemaps.js"></script> > > <script type="text/javascript" src="yada-yada"></script> > > {/if} > > {if $thickbox} > > <link rel="stylesheet" type="text/css" media="projection, screen" > > href="css/thickbox.css" /> > > <script type="text/javascript" src="js/thickbox.js"></script> > > {/if} > > ... > > Sorry, I should have noted I'm using a common header template file for > all pages that gets included in the page template. Something like this > in a page template: > {include file="header.tpl"} > [page content here] > {include file="footer.tpl"} > > I'm using the {if} statements to include the js files I need based on a > variable I set in the PHP file like you have above. Where I'm stuck is > now to set the js needed for the jQuery code into the HEAD. > > I guess I could use something like this in header.tpl > {if $jquerycode} > <script type="text/javascript"> > $jquerycode > </script> > {/if} > > and set $jquerycode in my PHP file. > > -- > Chris Scott > Adaptive Hosting Solutions, Inc. | Blogzerk - blog hosting > http://www.adaptivehostingsolutions.com/ | http://www.blogzerk.com/ > > _______________________________________________ > jQuery mailing list > [email protected] > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
