Hola,
No entiendo algunas cosas del esqueleto de una página la cual me tengo que encargar.
El fichero Index.php llama al fichero config.class.php y este tiene el siguiente contenido;
Código PHP:
<?php
include dirname(dirname(__FILE__)) . '/config/global.config.php';
include dirname(dirname(__FILE__)) . '/forms/config/forms.config.php';
include (SITE_ROOT . 'admin/qforms/qforms.config.php');
include(CLASS_PATH_PUBLIC.'common/common.class.php');
include(CLASS_PATH_PUBLIC.'common/email.class.php');
include(CLASS_PATH_PUBLIC.'common/fecha.class.php');
include(CLASS_PATH_PUBLIC.'common/files.class.php');
include(CLASS_PATH_PUBLIC.'common/strings.class.php');
include(CLASS_PATH_PUBLIC.'common/submitActions.class.php');
include(CLASS_PATH_PUBLIC.'common/db.class.php');
include(CLASS_PATH_PUBLIC.'common/util.class.php');
include(CLASS_PATH_PUBLIC.'common/images.class.php');
include(CLASS_PATH_PUBLIC.'common/paginador.class.php');
include(CLASS_PATH_PUBLIC.'modRewriteDispatcher.class.php');
include(CLASS_PATH_PUBLIC.'getData.class.php');
include(CLASS_PATH_PUBLIC.'kv.class.php');
include(CLASS_PATH_PUBLIC.'class.inputfilter_clean.php5');
include(CLASS_PATH_PUBLIC.'contents.class.php');
include(CLASS_PATH_PUBLIC.'layout.class.php');
include(CLASS_PATH_PUBLIC.'languages.class.php');
include(CLASS_PATH_PUBLIC.'youtube.class.php');
include(CLASS_PATH_PUBLIC.'general.class.php');
class configuration {
var $s;
var $submitActions;
var $common;
var $fecha;
var $db;
var $filter;
var $kv;
var $layout;
var $contents;
var $language;
var $gen;
var $yt;
var $email;
var $pager;
var $name;
var $idRecord = 0;
var $meta_title;
var $meta_description;
var $meta_keywords;
function configuration() {
kv :: site_maintenance();
$this->sessionStart();
$this->hostRedirection();
$this->db = new DB;
$this->connectToDb();
$this->filter = new InputFilter;
$this->filterUnwanted();
$this->s = new strings;
$this->language = new languages;
$this->common = new common($this);
$this->kv = new kv;
$this->fecha = new fecha($this);
$this->submitActions = new submitActions($this);
$this->email = new email($this);
$this->layout = new layout($this);
$this->contents = new contents($this);
$this->gen = new general($this);
$this->yt = new youtube($this);
$this->pager = new paginador($this);
$this->meta_description = trim($this->s->stripSlashEntities($GLOBALS['ARRAY_META_GLOBAL']["DESCRIPTION"]));
$this->meta_keywords = trim($this->s->stripSlashEntities($GLOBALS['ARRAY_META_GLOBAL']["KEYWORDS"]));
$this->meta_title = 'SANT CUGAT Business Park';
}
function filterUnwanted(){
$_POST = $this->filter->process($_POST);
$_GET = $this->filter->process($_GET);
}
function hostRedirection(){if ($_SERVER["HTTP_HOST"] != _siteDomain_){header("location: http://"._siteDomain_.$_SERVER["REQUEST_URI"]);exit;}}
function sessionStart(){session_start();}
function connectToDb(){$this->db->connectToDb();}
function cargarData($functionName){
$className = 'getData';
$a = array();
if (class_exists($className) and is_callable(array($className, 'f_getData_'.$functionName))){
$this->n = new $className($this);
$a = $this->n->{'f_getData_'.$functionName}();
}
else die('error en conf->cargarData() metodo: f_getData_'.$functionName.' no existe en la clase '.$className);
return $a;
}
function show($name='index', $flagPrivado=false, $flagNotLoggedPage=false){
$this->name = $name;
$this->common->grabarPaginaActual();
$aDatos = $this->cargarData($name);
$this->submitActions->performSubmitActions($aDatos);
$this->layout->html_start($aDatos);
$this->layout->html_body_start();
flush();
$this->layout->main_wrap_start();
flush();
$this->layout->shleft_start();
$this->layout->shright_start();
$this->layout->header_site($aDatos);
$this->layout->contents_start();
$this->layout->subcontents($aDatos);
$this->layout->maincontents_start($aDatos);
$this->contents->show($name, $aDatos);
$this->layout->maincontents_end();
$this->layout->contents_end();
$this->layout->footer($aDatos);
$this->layout->shright_end();
$this->layout->shleft_end();
$this->layout->shbot();
$this->layout->main_wrap_end();
$this->layout->html_body_end($aDatos);
$this->layout->html_end();
flush();
}
function dispatcherModRewrite(){
$rw = new modRewriteDispatcher($this);
$rw->dispatcher();
}
}
include(_includes_.'jsonwrapper/jsonwrapper.php');
?>
No entiendo lo siguiente;
include
dirname(dirname(__FILE__)) . '/config/global.config.php';
dirname devuelve el directorio padre, entonces esto devolvera el padre del padre? no entiendo porque se hace
Después esta FILE que he por lo que he leído "devuelve el nombre del fichero del include", Para qué quiero que devuelva el padre del padre del la ruta que he escrito? no es más simple poner include('./config/global.config.php')?
Esto de aquí abajo tampoco estoy seguro de porque se hace
include (
SITE_ROOT . 'admin/qforms/qforms.config.php');
include(
CLASS_PATH_PUBLIC.'common/common.class.php');
Gracias de antemano