Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty error: unable to read resource: "index.tpl"

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
nonamer
Smarty n00b


Joined: 15 Mar 2006
Posts: 3

PostPosted: Wed Mar 15, 2006 8:51 pm    Post subject: Smarty error: unable to read resource: "index.tpl" Reply with quote

I have followed the quick install instructions exactly but am getting the following error message:

"Warning: Smarty error: unable to read resource: "index.tpl" in /home/myusername/public_html/lib/php/Smarty/Smarty.class.php on line 1095"

I have read through several posts on this board but, unless I am missing something, I cannot find a resolution for it so I am hoping somone on these boards can help.

My server is running PHP 4.4.1 standard and Cpanel 10.8.1-RELEASE 113

My index.php file looks like

Code:

<?php

// put full path to Smarty.class.php
require('/home/dnb/public_html/lib/php/Smarty/Smarty.class.php');
$smarty = new Smarty();

$smarty->template_dir = '/home/myusername/public_html/www.mydomainname.com/smarty/templates';
$smarty->compile_dir = '/home/myusername/public_html/www.mydomainname.com/smarty/templates_c';
$smarty->cache_dir = '/home/myusername/public_html/www.mydomainname.com/smarty/cache';
$smarty->config_dir = '/home/myusername/public_html/www.mydomainname.com/smarty/configs';

$smarty->assign('name', 'Ned');
$smarty->display('index.tpl');

?>


I checked the troubleshooting section in Chapter 17 and everything seems to check out. The "index.tpl" file is in the smarty/templates/ directory as it should be.

I am a newbie to PHP. Any help would be greatly appreciated.
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Wed Mar 15, 2006 8:55 pm    Post subject: Reply with quote

why did you switch from "dnb" to "myusername" in your path selections? Also see this helpful faq item: http://www.phpinsider.com/smarty-forum/viewtopic.php?t=4500
Back to top
View user's profile Send private message
nonamer
Smarty n00b


Joined: 15 Mar 2006
Posts: 3

PostPosted: Wed Mar 15, 2006 9:02 pm    Post subject: Reply with quote

Actually, I didn't. I wanted to hide the username in my original post. It is correct in every line in the index.php file. Thanks for the link.
Back to top
View user's profile Send private message
nonamer
Smarty n00b


Joined: 15 Mar 2006
Posts: 3

PostPosted: Wed Mar 15, 2006 9:10 pm    Post subject: Reply with quote

Thanks again. I figured out the problem. Just to clarify how, I had to edit the index.php file to look like:

Code:
<?php

// put full path to Smarty.class.php
require('/home/dnb/public_html/lib/php/Smarty/Smarty.class.php');
$smarty = new Smarty();

$smarty->template_dir = '../smarty/templates';
$smarty->compile_dir = ../smarty/templates_c';
$smarty->cache_dir = '../smarty/cache';
$smarty->config_dir = '../smarty/configs';

$smarty->assign('name', 'Ned');
$smarty->display('index.tpl');

?>
Back to top
View user's profile Send private message
imadeel
Smarty n00b


Joined: 20 Dec 2006
Posts: 1

PostPosted: Wed Dec 20, 2006 1:27 am    Post subject: Reply with quote

Simple Answer which i discovered is create a configs and put your configuration file inside it and you can refer the configuration file anytime and smarty will grab it from there.

Wink
Back to top
View user's profile Send private message
c_domain
Smarty n00b


Joined: 19 Jan 2008
Posts: 1

PostPosted: Sat Jan 19, 2008 5:14 pm    Post subject: Hi nonamer, I am still getting the same error Reply with quote

Wats Wrong in my index.php file as below

---------0000----


DEFINE ('AREA', 'C');
DEFINE ('AREA_NAME' ,'customer');

require './prepare.php';
if (!empty($html_catalog)) {
define ('NO_SESSION', true);
}
require './init.php';

if (!empty($settings['General']['store_access_key'])) {
sess_register('store_access_key');
if (!empty($_GET['store_access_key'])) {
$store_access_key = $_GET['store_access_key'];
}
if ($store_access_key != $settings['General']['store_access_key']) {
fn_redirect('store_closed.html');
}
}
// Converting script vars to use in HTML catalog
if (!empty($html_catalog)) {
$index_script = $cscart_host_dir . '/' . $customer_index;
$image_index = $cscart_host_dir . '/' . $image_index;
// Disable ajax actions during html catalog generation
$settings['DHTML']['customer_ajax_based_pagination'] = 'N';
$settings['DHTML']['ajax_add_to_cart'] = 'N';
$settings['DHTML']['ajax_comparison_list'] = 'N';
$smarty->assign('image_index', $image_index);
} else {
$index_script = $customer_index;
}
$smarty->assign('index_script', $index_script);

//
// Common includes
//
include $common_dir.'customer_common.php';

fn_add_breadcrumb(fn_get_lang_var('home'), $index_script);

if (empty($target)) {
$target = 'index';
}

//
// Include target script from $script_targets array
//
if (file_exists(@$script_targets[$target])) {
include $script_targets[$target];
} else {
fn_set_exception('no_page');
}

if (!empty($_GET['ajax'])) {
fn_show_template('content.tpl', $smarty, false, $_GET['ajax'], true);
} else {
fn_show_template('index.tpl',$smarty, true);
}
?>


Thanks in advance
Back to top
View user's profile Send private message
koejkje
Smarty Rookie


Joined: 27 Nov 2003
Posts: 30
Location: Miami, Florida

PostPosted: Mon Mar 24, 2008 3:18 pm    Post subject: Reply with quote

What is the solution to this I have the same exact problem error line :

[24-Mar-2008 10:14:49] PHP Warning: Smarty error: unable to read resource: "search_box" in /usr/local/apache2/htdocs/domain.com/web/smarty/Smarty.class.php on line 1144
_________________
R. Stacy Cook
Edit-X :: Control Your Content
www.edit-x.com
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
sbhar
Smarty n00b


Joined: 03 Aug 2009
Posts: 1

PostPosted: Mon Aug 03, 2009 5:49 am    Post subject: try this Reply with quote

Code:

<?php

require_once('c:/phpdev/www/lib/Smarty.class.php');

$smarty = new Smarty();

$smarty->template_dir = 'guestbook/templates/';
$smarty->compile_dir  = 'guestbook/templates_c/';
$smarty->config_dir   = 'guestbook/configs/';
$smarty->cache_dir    = 'guestbook/cache/';

$smarty->assign('name','Ned');

//** un-comment the following line to show the debug console
$smarty->debugging = true;

$smarty->display('index.tpl');

?>
Back to top
View user's profile Send private message
genroxbro
Smarty Rookie


Joined: 29 Jul 2009
Posts: 6
Location: Canada

PostPosted: Fri Aug 07, 2009 6:38 pm    Post subject: Smarty error unable to read resource "index tpl" Reply with quote

Hi There

Im having the above error. When I accessed joomla through my browser for the first time it asked me to remove the installation files I thought that happened after the installation was complete? when I deleted the installation folder I get "Database Error: Unable to connect to the database:Could not connect to MySQL" I created the database on my remote server but Im new to Mysql. My admin panel allows me to import tables. is that an option... otherwise Im stumped?

Any help greatly appreciated

James

p.s. my host is UKcheapest
_____________________________________
Website I designed for payday loan company.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP