Index du Forum » » Le coin des codeurs

Auteur

Tiny_mce HS après URL Rewriting ou changement de nom de submit.php
freud
113     

  Posté : 16-05-2008 15:25

Ok, c'est bon

anciennement dans header.php :


// Made the title and pdst value from the pages.php config file
settype($PAGES, array());
global $pdst, $Titlesitename, $PHP_SELF;
require_once("themes/pages.php");
$pages_ref=basename($PHP_SELF);
if ($PAGES[$pages_ref][blocs]!="") {
$pdst=$PAGES[$pages_ref][blocs];
}
// Static page and Module can have Title ....
etc ....



Modification :


// Made the title and pdst value from the pages.php config file
settype($PAGES, array());
global $pdst, $Titlesitename, $PHP_SELF, $REQUEST_URI;

require_once("themes/pages.php");
//////////////////////////////
// Balises META personnalisées
$meta_url=parse_!!url(!!$REQUEST_URI);
$meta_url=$meta_url[path];
ereg("^/(.*)-([0-9]+)-(.*)\.html$", $meta_url, $meta_url2);

$type_url = $meta_url2[1];

if (isset($type_url)) {
$pages_ref = $type_url; // ex: article

} else {
$page_uri=split("[&?]",$REQUEST_URI);
$Npage_uri=count($page_uri);
$pages_ref=basename($page_uri[0]);
}

// Static page and Module can have Bloc, Title ....



Explications :

Je scinde mon url


$meta_url=$meta_url[path];
ereg("^/(.*)-([0-9]+)-(.*)\.html$", $meta_url, $meta_url2);



Si j'ai bien un type d'url rewrité comme /article-XX-titre.html, $page_ref prend comme valeur le type d'url (ici article). Sinon, je prends le cours normal ...


$type_url = $meta_url2[1];
if (isset($type_url)) {
$pages_ref = $type_url; // ex: article

} else {
$page_uri=split("[&?]",$REQUEST_URI);
$Npage_uri=count($page_uri);
$pages_ref=basename($page_uri[0]);
}




Reste plus qu'à identifier dans pages.php les types correspondant aux url rewritées :


$PAGES['article'][title]="[french]Article[/french] : $title+";
$PAGES['article'][blocs]="0";
$PAGES['article'][run]="yes";

$PAGES['discussion'][title]="[french]Discussion[/french] : $title / $post+";
...



++
Freud

Message édité par : freud / 16-05-2008 15:29




Cet article provient de NPDS

http://www.npds.org/viewtopic.php?topic=23585&forum=5