RE: [SMARTY] Smarty error: unable to read template resource
| From: | Gary Loescher | Date: | Fri, 08 Nov 2002 22:41:33 +0000 |
| Subject: | RE: [SMARTY] Smarty error: unable to read template resource | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6371@lists.php.net to get a copy of this message | ||
In your Smarty subclass constructor, have you tried setting
$template_dir = 'c:/apache/htdocs/SmartyExample/templates'?
Without the 'file' tag.
Also, have you tried the "default" file structure that has
templates, templates_c, etc. under the Smarty code directory?
One more note: if you decide to keep your templates under the
web root, you should disable direct browsing of them using an
.htaccess file.
Gary
>-----Original Message-----
>From: Diarmid Sloan [mailto:dsloan@kpoint.co.uk]
>Sent: Friday, November 08, 2002 2:59 AM
>To: smarty-general@lists.php.net
>Subject: [SMARTY] Smarty error: unable to read template resource
>
>
>Hi,
>
>I am trying to install Smarty on Windows 2000 Professional. I
>already have
>a working Apache and PHP installation. However, when
>attempting to code my
>own Smarty example or even use the existing example I keep getting the
>following error:
>
>Smarty error: unable to read template resource: "index.tpl" in
>C:/apache/php/pear/Smarty/Smarty.class.php
>on line 589
>
>I have viewed loads of postings on this problem in various
>newsgroups but
>they all make "suggestions" and no-one seems to indicate whether these
>work or not. I have tried all of them but to no avail.
>
>I have installed the Smarty directory under C:/apache/php/pear
>and added
>C:\apache\php\pear\Smarty into the PHP include_path. However,
>judging by
>the error the Smarty.class.php is being found ok so that isn't
>the problem.
>
>My example is called test.php and lives in
>C:/apache/htdocs/SmartyExample
>with the template index.tpl in the templates subdirectory.
>
>The web browser can see the template ok, it's just that the class
>seemingly can't. Most of the advice on newsgroups centres
>around checking
>directory permissions on the templates directory and the templates_c
>directory that I created. However, in Windows I have checked these and
>they are read/write/executable. Is there more than meets the eye to
>setting permissions on Windows directories? I thought these would be
>read/write/executable by default. In the folder properties they are
>accessible by "Everyone".
>
>I have also tried defining the template (and other)
>directories within the
>constructor of my extended Smarty class. I have tried using
>the absolute
>path, ie. "file:C:/apache/htdocs/SmartyExample/templates/",
>defining the
>path relative to the web server document root, ie.
>"/SmartyExample/templates/" (with and without the trailing
>slash) and the
>error just won't go away.
>
>Any suggestions before I tear all my hair out!
>
>Thanks,
>Diarmid Sloan
>
>
>--
>Smarty General Mailing List (http://smarty.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>