Ciao a tutti, nel mio sito ho un problema!
Ho installato PKP, configurato ecc..funziona tutto!
Ora io voglio che nel template "layout" sia messo un nuovo codice ([[newslist]]) in pratica li viene incluso un file php che ho creato io con la connessione per visualizzare alcuni dati del mysql!
Ecco il codice:
index.php
Codice PHP:
<?php
/*
Copyright 2006,2007 Paolo "pop killer" Di Febbo
This file is part of PKP (pop killer portal).
PKP is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
PKP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PKP; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// Include connect library and security library
include "connect.php";
include "security.php";
// check magic quotes
check_mqgpc();
// Initialize database object
$DB = new database;
// If user hasn't got auth...
if(!control_auth()){echo "You are not authorized to view this page.";}
else{
check_attack(); // Check if there are attack attempts
$globalarray = $DB->queryAndFetch("SELECT * FROM global"); //Query DB for global variabiles
// Includes the content module, the template file and the phpIIS library
include "content.php";
include "layout/".$globalarray[2]."/html.php";
include "phplib.php";
$index = ereg_replace("\[\[title\]\]", $globalarray[0], $layout['layout']);
$index = ereg_replace("\[\[style\]\]", $layout['style'], $index);
$index = ereg_replace("\[\[menu\]\]", printMenu(), $index);
$index = ereg_replace("\[\[content\]\]", content_start($globalarray[1]), $index);
$index = ereg_replace("\[\[credits\]\]", "This website is powered by <a class=\"small\" href=\"http://pkp.sourceforge.net/\">PKP 0.7</a>, made by pop killer and licensed under the GNU GPL license", $index);
$index = ereg_replace("\[\[newslist\]\]", include "articoli.php", $index);
// When the page is complete, interpret eventual php code (made by the user)
$interpreted_index = phpiis($index);
echo $interpreted_index;
}
// Shows website menu
function printMenu(){
global $DB, $layout;
$return = "";
$query = mysql_query("SELECT id,name,tipo FROM category ORDER BY ordine");
while($echo = mysql_fetch_array($query)){
if($echo[2] == "1"){
$html = $DB->queryAndFetch("SELECT text FROM category WHERE id='".$echo[0]."'");
$CATEGORY = $html[0];
}
else{
$CATEGORY = "<ul>\n";
$querylink = mysql_query("SELECT id,name,tipo FROM content WHERE category=".$echo[0]." AND tipo<>'1' ORDER BY ordine");
while($echo2 = mysql_fetch_array($querylink)){
if($echo2[2] == 2){
$text = $DB->queryAndFetch("SELECT text FROM content WHERE id=".$echo2[0]." ORDER BY ordine");
$link = explode(";", $text[0]);
$CATEGORY .= "<li><a href=\"".$link[1]."\" target=\"".$link[0]."\">".$echo2[1]."</a></li>\n";
}
elseif($echo2[2] == 6){
$CATEGORY .= "<li><a href=\"index.php?act=galleria\">".$echo2[1]."</a></li>\n";
}
else{
$CATEGORY .= "<li><a href=\"index.php?act=".$echo2[0]."\">".$echo2[1]."</a></li>\n";
}
}
$CATEGORY .= "</ul>\n";
}
$category_echo = ereg_replace("\[\[title\]\]", $echo[1], $layout['category']);
$category_echo = ereg_replace("\[\[category\]\]", $CATEGORY, $category_echo);
$return .= $category_echo;
}
return $return;
}
?>
Ho aggiunto:
Codice PHP:
$index = ereg_replace("\[\[newslist\]\]", include "articoli.php", $index);
In pratica io scrivo "[[newslist]]" nel template "layout" da admin e li mi si deve sostituire con il file "articoli.php" (incluso)..e quel file si trova nella stessa cartella dove si trova il file "index.php" (il codice sopra postato)..
E mi da Errore 500 (500 Internal Server Error)
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, *EMAIL* and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Grazie!..Ciao! ^^