![Smarty Forum Index Smarty Forum Index](templates/smarty/images/phpbb2_logo.gif) |
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
knutsford Smarty n00b
Joined: 22 Nov 2020 Posts: 3
|
Posted: Sun Nov 22, 2020 12:18 pm Post subject: index.tpl not found |
|
|
I have a files called SmartyLibrary.php in libraries under codeigniter
Code: |
<?php defined('BASEPATH') OR exit('No direct script access allowed');
require_once(APPPATH . 'third_party/smarty/libs/Smarty.class.php');
class SmartyLibrary extends Smarty {
function __construct() {
parent::__construct();
// Define directories, used by Smarty:
$this->setTemplateDir(APPPATH . 'views/templates');
$this->setCompileDir(APPPATH . 'cache');
$this->setCacheDir(APPPATH . 'cache');
}
} |
I have
$autoload['libraries'] = array('SmartyLibrary' => 'smarty');
in autoload.php
I have an index.tpl under views/templates
I am getting
An uncaught Exception was encountered
Type: SmartyException
Message: Unable to load template 'file:index.tpl'
If I look at the Smarty array it says
[template_dir:protected] => Array
(
[0] => /var/www/vhosts/blaablaa.co.uk/httpdocs/system/templates/
)
Shouldn't it say
[template_dir:protected] => Array
(
[0] => /var/www/vhosts/blaablaa.co.uk/httpdocs/system/application/views/templates/
)
It is as though
$this->setTemplateDir(APPPATH . 'views/templates'); is being ignored
any idea what the problem is please? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Nov 23, 2020 3:39 pm Post subject: |
|
|
Extending Smarty class is a bad idea. |
|
Back to top |
|
knutsford Smarty n00b
Joined: 22 Nov 2020 Posts: 3
|
Posted: Mon Nov 23, 2020 3:57 pm Post subject: |
|
|
Why?
I googled and copied that bit of code or do you mean not to use smarty in the first place? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
knutsford Smarty n00b
Joined: 22 Nov 2020 Posts: 3
|
Posted: Tue Nov 24, 2020 7:55 am Post subject: |
|
|
I am being thick but I still don't see why |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Nov 24, 2020 1:53 pm Post subject: |
|
|
Run
Code: | $this->testInstall(); |
at the end of the constructor for tests. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|