Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I'm new to PHP and Smarty. I'm following the recipe in a book for creating an e-commerce site, and I'm using Windows XP on my home PC with PHP 5.2.3 and Smarty 2.6.18.
Here is the error:
---------------------------------------------
ERRNO: 8
TEXT: Use of undefined constant SMARTY_DIR - assumed 'SMARTY_DIR'
LOCATION: C:\tshirtshop\include\setup_smarty.php, line 6, at August 22, 2007, 8:50 am
Showing backtrace:
require_once("C:\tshirtshop\include\setup_smarty.php") # line 5, file: C:\tshirtshop\include\app_top.php
require_once("C:\tshirtshop\include\app_top.php") # line 6, file: C:\tshirtshop\index.php
ERRNO: 2
TEXT: require_once(SMARTY_DIRc:/tshirtshop/libs/smarty/Smarty.class.php) [function.require-once]: failed to open stream: Invalid argument
LOCATION: C:\tshirtshop\include\setup_smarty.php, line 6, at August 22, 2007, 8:50 am
Showing backtrace:
require_once() # line 6, file: C:\tshirtshop\include\setup_smarty.php
require_once("C:\tshirtshop\include\setup_smarty.php") # line 5, file: C:\tshirtshop\include\app_top.php
require_once("C:\tshirtshop\include\app_top.php") # line 6, file: C:\tshirtshop\index.php
--------------------------------------------
My Internet search for help leads me to conclude I've done something wrong specifying the paths, but I have tried several things and nothing fixes the error.
Here is how it unfolds:
index.php says:
------------------------------------------------Code: Select all
// load Smarty library and config files
require_once 'include/app_top.php';app_top.php says:
-----------------------------------------------
Code: Select all
require_once 'setup_smarty.php';-----------------------------------------------
setup_smarty.php says:
-----------------------------------------------
Code: Select all
// Reference Smarty library
require_once SMARTY_DIR. "c:/tshirtshop/libs/smarty/Smarty.class.php";
// Class that extends Smarty, used to process and display Smarty files
class Page extends Smarty
{
// constructor
function __construct()
{
// Call Smarty's constructor
$this->Smarty();
// Change the default template directories
$this->template_dir = TEMPLATE_DIR;
$this->compile_dir = COMPILE_DIR;
$this->config_dir = CONFIG_DIR;
$this->plugins_dir[0] = SMARTY_DIR . 'plugins';
$this->plugins_dir[1] = SITE_ROOT . "/smarty_plugins";
}Smarty.class.php says:
-------------------------------------------------
Code: Select all
/**
* set SMARTY_DIR to absolute path to Smarty library files.
* if not defined, include_path will be used. Sets SMARTY_DIR only if user
* application has not already defined it.
*/
if (!defined('SMARTY_DIR')) {
define('SMARTY_DIR', 'c:/tshirtshop/libs/smarty/');
}the path in the php.ini file, which is in the Windows directory, says:
---------------------------------------------------------
Code: Select all
; Windows: "\path1;\path2"
include_path = ".;c:\php\includes;c:\tshirtshop\libs\;"Where have I gone wrong?
thanks for suggestions.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]