Smarty problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daan

    #1

    Smarty problems

    Hello all,

    I'm having a little problem with Smarty. Getting it to work in a simple
    case went fine, but now I have the following situation:

    /
    /smarty
    /templates
    template.tpl
    /templates_c
    /configs
    /lezingen/
    lezingen_beh.ph p
    agenda_beh.php
    /index.php

    With files such as index.php, I can just access smarty by including
    "smarty/Smarty.class.ph p" and displaying it with
    $smarty->assign("templa te.tpl").

    However, in the directory "lezingen" (which is protected using a
    ..htaccess file, but I doubt if that is of any relevance here) I am
    unable to get smarty to work. I have tried adding the following code to
    lezingen_beh.ph p and agenda_beh.php:

    set_include_pat h(get_include_p ath() . ":../smarty");

    This seems to solve *part* of the problem, but it still gives the
    following error:

    Warning: Smarty error: unable to read template resource: "template.t pl"
    in /very_long_path/nieuw/smarty/Smarty.class.ph p on line 1042

    Can anyone point out what the problem is and also how to fix it? I
    couldn't figure it out using the smarty or php documentation.. .

    Thanks in advance for any help,

    --
    Daan
  • Garp

    #2
    Re: Smarty problems


    "Daan" <d_stolp@NoSpam Hotmail.com> wrote in message
    news:cbp845$lek $1@netlx020.civ .utwente.nl...[color=blue]
    > Hello all,
    >
    > I'm having a little problem with Smarty. Getting it to work in a simple
    > case went fine, but now I have the following situation:
    >
    > /
    > /smarty
    > /templates
    > template.tpl
    > /templates_c
    > /configs
    > /lezingen/
    > lezingen_beh.ph p
    > agenda_beh.php
    > /index.php
    >
    > With files such as index.php, I can just access smarty by including
    > "smarty/Smarty.class.ph p" and displaying it with
    > $smarty->assign("templa te.tpl").
    >
    > However, in the directory "lezingen" (which is protected using a
    > .htaccess file, but I doubt if that is of any relevance here) I am
    > unable to get smarty to work. I have tried adding the following code to
    > lezingen_beh.ph p and agenda_beh.php:
    >
    > set_include_pat h(get_include_p ath() . ":../smarty");
    >
    > This seems to solve *part* of the problem, but it still gives the
    > following error:
    >
    > Warning: Smarty error: unable to read template resource: "template.t pl"
    > in /very_long_path/nieuw/smarty/Smarty.class.ph p on line 1042
    >
    > Can anyone point out what the problem is and also how to fix it? I
    > couldn't figure it out using the smarty or php documentation.. .
    >
    > Thanks in advance for any help,
    >
    > --
    > Daan[/color]

    What's your $template_dir set to?



    Quote:
    $template_dir
    This is the name of the default template directory. If you do not supply a
    resource type when including files, they will be found here. By default this
    is "./templates", meaning that it will look for the templates directory in
    the same directory as the executing php script.

    Technical Note: It is not recommended to put this directory under the web
    server document root.


    Garp


    Comment

    • Daan

      #3
      Re: Smarty problems

      Garp wrote:[color=blue]
      > "Daan" <d_stolp@NoSpam Hotmail.com> wrote in message
      > news:cbp845$lek $1@netlx020.civ .utwente.nl...
      >[color=green]
      >>Hello all,
      >>
      >>I'm having a little problem with Smarty. Getting it to work in a simple
      >>case went fine, but now I have the following situation:
      >>
      >>/
      >>/smarty
      >>/templates
      >>template.tp l
      >>/templates_c
      >>/configs
      >>/lezingen/
      >>lezingen_beh. php
      >>agenda_beh.ph p
      >>/index.php
      >>
      >>With files such as index.php, I can just access smarty by including
      >>"smarty/Smarty.class.ph p" and displaying it with
      >>$smarty->assign("templa te.tpl").
      >>
      >>However, in the directory "lezingen" (which is protected using a
      >>.htaccess file, but I doubt if that is of any relevance here) I am
      >>unable to get smarty to work. I have tried adding the following code to
      >>lezingen_beh. php and agenda_beh.php:
      >>
      >>set_include_p ath(get_include _path() . ":../smarty");
      >>
      >>This seems to solve *part* of the problem, but it still gives the
      >>following error:
      >>
      >>Warning: Smarty error: unable to read template resource: "template.t pl"
      >>in /very_long_path/nieuw/smarty/Smarty.class.ph p on line 1042
      >>
      >>Can anyone point out what the problem is and also how to fix it? I
      >>couldn't figure it out using the smarty or php documentation.. .
      >>[/color]
      > What's your $template_dir set to?
      >
      > http://smarty.php.net/manual/en/api....e.template.dir
      >
      > Quote:
      > $template_dir
      > This is the name of the default template directory. If you do not supply a
      > resource type when including files, they will be found here. By default this
      > is "./templates", meaning that it will look for the templates directory in
      > the same directory as the executing php script.[/color]

      Ah, thanks! Setting template dir to "../templates" did the trick!
      $smarty->template_dir = "../templates";

      --
      Daan

      Comment

      Working...