Config files and directories
| From: | Reynier Pérez Mira | Date: | Thu, 07 Apr 2005 15:10:22 +0000 |
| Subject: | Config files and directories | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-12433@lists.php.net to get a copy of this message | ||
Well it's me again. The problem now is with config
files and directories. Take a look to my site
structure:
*******************************************************
-root directory
-admin
index.php
logout.php
.
-class
DB
smarty
phpmailer
PEAR.php
DB.php
-FCKEditor
.
-images
.
-language
.
-themes
config
jc_conf.conf
images
.
js
md5.js
jovenclub.js
styles
jovenclub.css
themes_c
.
middle.tpl
header.tpl
footer.tpl
.
index.php
webmail.php
forums.php
.
******************************************************
when I access to index.php file all happen ok. This is
the code:
:: index.php ::
------------------------------------------------------
<?php
session_start();
require("class/smarty/Smarty.class.php");
include_once("language/lang-spanish.php");
include_once('class/DB.php');
$template = new Smarty();
$dsn =
'mysql://root:reyniermysql@localhost/jovenclub';
$database = DB::connect($dsn);
if (DB::isError($database)) {
die($database->getMessage());
}
/* Class smarty config */
$template->template_dir = "themes/";
$template->compile_dir = "themes/themes_c/";
$template->config_dir = "themes/config/";
$template->compile_check = true;
/* Check if user is loged in or not */
if(isset($_SESSION['uname']) &&
($_SESSION['uname']!=null || $_SESSION['uname']!="")){
$uname = base64_decode($_SESSION['uname']);
$template->assign("WELCOME",_WELCOME);
$template->assign("USERNAME", $uname);
}else{
$template->assign("CONECTORREGISTER",_CONECTORREGISTER);
}
/* Obtain data from DB */
$result = $database->query('SELECT * FROM
frases_celebres ORDER BY RAND()');
while(list($frase,$autor) = $result->fetchRow ()){
$template->assign("FRASE_CELEBRE",$frase." -
".$autor);
}
/* Assign values to constants or dinamic vars */
$template->assign("COPYRIGHT",COPYRIGHT);
$template->assign('yesterday', strtotime('-1 day'));
/* Display templates */
$template->display("header.tpl");
$template->display("middle.tpl");
$template->display("footer.tpl");
?>
------------------------------------------------------
and this is the header.tpl file and see the adress of
congig file is in the same directory that themes or
tpl files
------------------------------------------------------
{config_load file="jc_conf.conf"}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
------------------------------------------------------
the way in that call this page is it:
http://myserver.com/index.php
but when I try to access from a folder something like
this:
http://myserver.com/admin/index.php
the smarty class not load config file. This is the
code for admin/index.php
------------------------------------------------------
<?php
session_start();
require("../class/smarty/Smarty.class.php");
include_once("../language/lang-spanish.php");
include_once('../class/DB.php');
$template = new Smarty();
$dsn = 'mysql://jcce:jccegrm03@localhost/jovenclub';
$database = DB::connect($dsn);
if(DB::isError($database)) {
die($database->getMessage());
}
/* Class smarty config */
$template->template_dir = "../themes/";
$template->compile_dir = "../themes/themes_c/";
$template->config_dir = "../themes/config/";
$template->compile_check = true;
/* Check if user is loged in or not */
if(isset($_SESSION['uname']) &&
($_SESSION['uname']!=null || $_SESSION['uname']!="")){
$uname = base64_decode($_SESSION['uname']);
$template->assign("WELCOME",_WELCOME);
$template->assign("USERNAME", $uname);
}else{
$template->assign("CONECTORREGISTER",_CONECTORREGISTER);
}
/* Obtain data from DB */
$result = $database->query('SELECT * FROM
frases_celebres ORDER BY RAND()');
while(list($frase,$autor) = $result->fetchRow ()){
$template->assign("FRASE_CELEBRE",$frase." -
".$autor);
}
/* Assign values to constants or dinamic vars */
$template->assign("COPYRIGHT",COPYRIGHT);
$template->assign('yesterday', strtotime('-1 day'));
$template->display("header.tpl");
$template->display("admin.tpl");
$template->display("footer.tpl");
?>
------------------------------------------------------
what's wrong? How can I solve this error?
Regards
Reynier Pérez MiraBlog de ReynierPM
______________________________________________
Renovamos el Correo Yahoo!: ¡250 MB GRATIS!
Nuevos servicios, más seguridad
http://correo.yahoo.es