View previous topic :: View next topic |
Author |
Message |
ShenKong Smarty Rookie
Joined: 20 Jan 2004 Posts: 27
|
Posted: Tue Jan 20, 2004 5:35 am Post subject: Question About Include Path |
|
|
I am Chinese , English is not good , can't use search engine well .
New for useing Smarty .
My system : Windows Server 2003 / PHP 4.3.4 / Smarty 2.6.1 / Apache 2.0.48 / Zend Studio
My directory:
libs/
demo/
Fiest I modify the demo/index.php line 3 as:
Code: | require "../libs/Smarty.class.php"; |
zend Studio said :
Code: | Warning: fetch(../libs\core\core.get_microtime.php): failed to open stream: No such file or directory in ../libs/Smarty.class.php on line 1170
Fatal error: fetch(): Failed opening required '../libs\core\core.get_microtime.php' (include_path='C:\php\PEAR') in ../libs/Smarty.class.php on line 1170 |
But I browse From IE , display :
Code: | Warning: fetch(templates_c\%%117\%%1172603085\index.tpl.php): failed to open stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\libs\Smarty.class.php on line 1279
Warning: fetch(): Failed opening 'templates_c\%%117\%%1172603085\index.tpl.php' for inclusion (include_path='C:\php\PEAR') in C:\Program Files\Apache Group\Apache2\htdocs\libs\Smarty.class.php on line 1279
Warning: _include(templates_c\%%138\%%138092194\debug.tpl.php): failed to open stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\libs\Smarty.class.php on line 1979
Warning: _include(): Failed opening 'templates_c\%%138\%%138092194\debug.tpl.php' for inclusion (include_path='C:\php\PEAR') in C:\Program Files\Apache Group\Apache2\htdocs\libs\Smarty.class.php on line 1979 |
I think the include path has something wrong , I modify these lines:
line 1279:
Code: | include($_smarty_compile_path); |
as
Code: | include("./$_smarty_compile_path"); |
line 1979:
Code: | return include($filename); |
as
Code: | return include("./$filename"); |
Save it .
Zend Studio also said :
Code: | Warning: fetch(../libs\core\core.get_microtime.php): failed to open stream: No such file or directory in ../libs/Smarty.class.php on line 1170
Fatal error: fetch(): Failed opening required '../libs\core\core.get_microtime.php' (include_path='C:\php\PEAR') in ../libs/Smarty.class.php on line 1170 |
But From IE :
I continue to modify this line:
line 1925:
Code: | include($_smarty_compile_path); |
as
Code: | include("./$_smarty_compile_path"); |
Zend Studio said the same
IE said :
Code: | Warning: smarty_function_config_load(templates_c\%%378\%%378266902\test.conf%7Csetup.php): failed to open stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\libs\plugins\function.config_load.php on line 97
Warning: smarty_function_config_load(): Failed opening 'templates_c\%%378\%%378266902\test.conf%7Csetup.php' for inclusion (include_path='C:\php\PEAR') in C:\Program Files\Apache Group\Apache2\htdocs\libs\plugins\function.config_load.php on line 97 |
Modify it :
line 97
Code: | include($_compile_file); |
as
Code: | include("./$_compile_file"); |
Until now , the demo runs OK ,
But I think there are many lines about the include path I need to modify . This is not a good idea . I want to know why does it run like this ? How do I do now ?
Thanks everyone . _________________ Something comes soon ...
http://www.showtop.net
http://www.openphp.cn |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Tue Jan 20, 2004 9:11 am Post subject: |
|
|
you can add the dot to your include_path, that should help:
[php:1:ba6012059a]
ini_set('include_path', '.' . PATH_SEPARATOR . ini_get('include_path'));
[/php:1:ba6012059a]
as an alternative you can define SMARTY_DIR as full path to the smarty/libs-directory, before you include Smarty.class.php. And after instanciating $smarty you can configure $smarty->template_dir and $smarty->compile_dir to be full paths to the according directories. |
|
Back to top |
|
ShenKong Smarty Rookie
Joined: 20 Jan 2004 Posts: 27
|
Posted: Tue Jan 20, 2004 9:50 am Post subject: |
|
|
OK , Thanks , but I don't think int_set can run well .
I modify this in smarty.class.php :
[php:1:901a004bb8] var $template_dir = './templates';
var $compile_dir = './templates_c';
var $config_dir = './configs';
var $plugins_dir = array('./plugins');[/php:1:901a004bb8] _________________ Something comes soon ...
http://www.showtop.net
http://www.openphp.cn |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
|
Back to top |
|
ShenKong Smarty Rookie
Joined: 20 Jan 2004 Posts: 27
|
Posted: Tue Jan 20, 2004 11:10 am Post subject: |
|
|
I don't know well with smarty .
ini_set or SMARTY_DIR changes the path with absolute path .
But when you use always change server , Absolute path is not a good idea . Opposite path is OK . You say : Extended Setup , a good idea . but I think use opposite path is the best .
One Question : What is "SMARTY_DIR" before it has been defined ?
I don't understand what does it do?
ini_set('include_path', '.' . PATH_SEPARATOR . ini_get('include_path'));
My English is not good , do you understand what I say ? _________________ Something comes soon ...
http://www.showtop.net
http://www.openphp.cn |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Tue Jan 20, 2004 11:40 am Post subject: |
|
|
ShenKong wrote: | I don't know well with smarty .
ini_set or SMARTY_DIR changes the path with absolute path .
But when you use always change server , Absolute path is not a good idea . Opposite path is OK . You say : Extended Setup , a good idea . but I think use opposite path is the best . |
i often do something. like this in my config.php:[php:1:2b90c886f2]
define(BASEDIR, dirname(__FILE__) . DIRECTORY_SEPARATOR); // this sets BASEDIR to a full-path even if you move the file to another server.
define('SMARTY_DIR', BASEDIR . 'smarty/libs/'); /* you see i easily get lazy with DIRECTORY_SEPARATOR */
require_once(SMARTY_DIR . 'Smarty.class.php');
$smarty = new Smarty;
$smarty->template_dir = BASEDIR . 'templates'; /* no trailing separator needed here, btw */[/php:1:2b90c886f2]
so my paths are full-paths when files are accessed, but they are all relative to where i installed the files.
Quote: | One Question : What is "SMARTY_DIR" before it has been defined ? |
umm. it's undefined. it gets defined on top of Smarty.class.php, but only if you didn't define it earlier yourself.
Quote: | I don't understand what does it do?
ini_set('include_path', '.' . PATH_SEPARATOR . ini_get('include_path')); |
it prepends ".;" before your include_path. if your include_path was for example "C:\php" then it becomes ".;C:\php" . |
|
Back to top |
|
ShenKong Smarty Rookie
Joined: 20 Jan 2004 Posts: 27
|
Posted: Tue Jan 20, 2004 12:31 pm Post subject: |
|
|
Your config.php runs very good . Thanks for your share .
My system is new . I didn't set the include_path in php.ini but yesterday I Install PEAR , the Program set it by itself . I don't know what is the different between ".;C:\PHP\PEAR; C:\PHP\Smarty" and "C:\PHP\PEAR; C:\PHP\Smarty" ? The comment is after ";" in ini files, isn't it?
And , Zend Studio always runs error , a bug ? Zend or Smarty or my system setting ? _________________ Something comes soon ...
http://www.showtop.net
http://www.openphp.cn |
|
Back to top |
|
|