Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/03/2009, 09:06
cesaritoo
 
Fecha de Ingreso: febrero-2009
Mensajes: 16
Antigüedad: 15 años, 3 meses
Puntos: 0
problema con document root

Hola, les comento el problema, tengno un calendario hecho en php que si lo ejecuto desde la carpeta donde se encuentra (calendario/index.php) funciona bien, pero necesito mostrarlo en el index entonces lo llamo mediante la funcion include(). Hasta ahi todo bien, pero en uno de los archivos devo configurar el "document root" y parece que al llamar al archivo mediante include() no esta bien la ruta o no se como ponerla.. a continuacion les dejo los archivos para que vean el codigo

calendario/index.php :
Código PHP:
//-- calendar use example --//
include("calendario/calendar.php");
$calendar = new WingedCalendar();
$calendar->show_calendar(10);

//-- check document root setting --//
print dirname($_SERVER['PHP_SELF'])==$calendar->htpath'<p>Document Root is set correctly.</p>' '<p>Error: Wrong document root. Ask your host about it.</p>'
calendario/calendar.php:
Código PHP:
$cal_cfg = array('path' => str_replace('\\''/'dirname(__FILE__)));
include(
$cal_cfg['path'] . '/config.php');


function 
WingedCalendar() {
        global 
$cal_cfg;
        
$this->templates $cal_cfg['template'];
        
$this->password $cal_cfg['password'];
        
$this->sunday_endweek $cal_cfg['sunday_endweek'];
        
$this->months $cal_cfg['month'];
        
$this->timezone $cal_cfg['timezone'];
        
$this->charset $cal_cfg['charset'];
        
$this->html $cal_cfg['html'];
        
$this->hour12 $cal_cfg['12_hour'];
        
$this->datapath $cal_cfg['path'] . '/data.txt';
        
$docroot $cal_cfg['document_root']? $cal_cfg['document_root'] : $_SERVER['DOCUMENT_ROOT'];
        
$this->htpath str_replace($docroot''$cal_cfg['path']);
        for (
$i=0$n=count($cal_cfg['day']); $i<$n$i++) {
            
$this->days[]['day'] = $cal_cfg['day'][$i];
        }
    } 
calendario/config.php:
Código PHP:
//-- document root --//
$cal_cfg['document_root'] = '/home/natacion/public_html/'
Al ejecturarlo desde el index del sitio me imprime "Error: Wrong document root. Ask your host about it" y no se que poner en el document root para que funcione bien, o en donde debo modificar algo

GRACIAS desde ya!-)

Última edición por cesaritoo; 05/03/2009 a las 09:19 Razón: agregar codigo