SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2001
    Location
    San Francisco
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    include js in a smarty template?

    Hello - I have a smarty template header which has to bring in some .js filed for the dropdown menu. I thought it might be file path confusion, but I've tried the absolute path and it still does not load. What's the deal with smarty templates and loading .js files?

    thanks
    signature

  2. #2
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is none, but it would be helpful to see some code!
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2001
    Location
    San Francisco
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks -

    pretty much what's going on is in two template files - a header template 'head.tpl' and 'program.tpl' - head.tpl is a header for program.tpl.

    head tpl is supposed to look as follows - http://www.itsyourworld.org/templates/head.tpl

    the first lines of head.tpl are:

    Code:
    <html>
    <head>
    <title>World Affairs Council of Northern California</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    <script language="JavaScript1.2" src="sample_data.js"></script>
    <script language="JavaScript1.2" src="dqm_script.js"></script>
    
    </head>
    those two scripts are the problem. they are in the same dir as head.tpl. I've moved em around to different directories, given absolute file pathes, etc... they just don't seem to load.

    they're being loaded from program.tpl, also in the same direcory, with the following code.
    Code:
    {include file="head.tpl"}
    ends up giving me 'object expected' errors, as here:

    http://www.itsyourworld.org/program2.php?page=404

    if you mouse over the menu items.

    weird - seems like the template system won't let it load or something. any ideas?
    signature

  4. #4
    SitePoint Zealot
    Join Date
    Oct 2002
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The paths are relative to the PHP script that loads the templates not to the template-directory.

    Try putting them in the same dir as the PHP script that uses the templates (the template dir shouldn't be below the web-server root anyway).
    include_once('./sig.inc.php');


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •