Menu

#1 Variaveis de Path e URL

open
nobody
None
5
2007-10-21
2007-10-21
No

Rafaiel,

Depois de tanto sofrer com o cmsPath e com a falta de variaveis no izzy que contenham as URLs do sistema mudei o System aqui com o código abaixo.

Veja se vale colocar isso no core:

=======================
function System(){
$this->cmsFullPath = str_replace( "/index.php", "", str_replace( "\\", "/", $_SERVER["SCRIPT_FILENAME"] ) );
// $this->cmsPath = preg_replace( "/(index(\.php)?.*|\?.*)/", "", $_SERVER["REQUEST_URI"] );

//By wtavares
//This is the right definition of cmsPath.
//When using REQUEST_URI paths in subfolders or rewrited representes the wrong path.
//When use the above way, the path is always represents the location (virtual path) of cms is running.
$this->cmsPath = str_replace("\\", "/",str_replace($_SERVER['DOCUMENT_ROOT'], '', str_replace("index.php", "", $_SERVER['SCRIPT_FILENAME'])));

$this->cmsPath = preg_replace("/\/$/", "", $this->cmsPath);

$this->scriptURI = $_SERVER["SCRIPT_URI"];
$vTmp = str_replace("/", "\/", $this->cmsPath);
$this->baseURI = preg_replace("/{$vTmp}(.*)$/", "", $this->scriptURI);
$this->fullURI = $this->baseURI.$this->cmsPath;

$this->path = $this->cmsPath;
$this->fullPath = $this->cmsFullPath;
}
===========================

[]'s
WLT

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.