All you should have to do is set a var in your include statement.
{include file="header.tpl" $jqueryWhatever=1}
And then in your header, use:
{if isset($jqueryWhatever)}
<script>
{/if}
Then you can call each individual script on a per template basis.
-Marshall
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Chris Scott
Sent: Wednesday, February 14, 2007 8:55 AM
To: jQuery Discussion.
Subject: Re: [jQuery] Using jQuery and Smarty
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/