You can define a javascript/css slot in your master template and fill them
in your templates.

Example of master.pt:

<html>

<head>
    <tal:comment replace="nothing">
        Various slots where you can insert elements in the header from a
template.
    </tal:comment>
    <metal:styleslot define-slot="style_slot" />
    <metal:javascriptslot define-slot="javascript_head_slot" />
</head>

<body>
 <! -- bla bla bla stuff -->
</body>

</html>

Example of some foo.pt

<!DOCTYPE html>
<html lang="en"
      xmlns="http://www.w3.org/1999/xhtml";
      xml:lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal";
      xmlns:metal="http://xml.zope.org/namespaces/metal";
      metal:use-macro="master_template.macros['master']">
<head>
<metal:css fill-slot="style_slot">
  <link rel="stylesheet"
href="${request.static_url('spionisto.web:static/css/controlpanel.css')}" />
</metal:css>
<metal:js fill-slot="javascript_head_slot">
  <script
src="${request.static_url('spionisto.web:static/js/libs/jquery-1.5.1.min.js')}"
type="text/javascript"></script>
  <script
src="${request.static_url('spionisto.web:static/js/libs/jquery.tools.min.js')}"
type="text/javascript"></script>
  <script src="${request.static_url('spionisto.web:static/js/viewer.js')}"
type="text/javascript"></script>
</metal:js>
</head>
<body>
  <metal:content fill-slot="maincontent_slot">
    <article>
      <header>
        <h2>Add camera</h2>
        <form tal:replace="structure form" />
      </header>
    </article>
  </metal:content>
</body>
</html>


--
Noe

2012/4/18 Vincent Catalano <[email protected]>

> Each of my views has a separate template and each of these templates
> extends the base template. However, each of my views uses a different
> Javascript file. What is the best way to include different Javascript
> files for each page using Chameleon templates? Thanks for your help!
>
> --Vincent
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" 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/pylons-discuss?hl=en.
>
>


-- 
---
Noe Nieto
NNieto Consulting Services
M: [email protected]
W: http://noenieto.com
T:  @tzicatl <https://twitter.com/#%21/tzicatl>
Li: Perfil en LinkedIn <http://www.linkedin.com/profile/view?id=84300665>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en.

Reply via email to