PHP-Code:
if (isset($_GET['pageID'])) {
show_page($_GET['pageID']);
} else {
show_page('1');
}
if (isset($_GET['pageID'])) {
show_page($_GET['pageID']);
} else {
show_page('1');
}
function show_page($param) {
global $db, $smarty;
$id = $_GET['pageID'];
$_GET['id'] = $_GET['pageID'];
$result = $db->query("
SELECT
pageID as id, pageNAME as pname, pageTitle as ptitle, pageContent as pcontent
FROM
d3b_pages
WHERE
pageID = '$id'
");
function show_page($id = 1) {
}
function show_page($id){
global $db,$smarty;
$result = $db->query( "SELECT * FROM ` bla` WHERE `pageID` = {$id}" );
if(!$result){
//tu was
}
//hier kommt das ganze smarty-assignment-zeugs
//die rekursion die hier steht nimmst du raus
//if(isset($_GET['pageID'])){ show_page($_GET['pageID']); }else{}
//und noch anzeigen
$smarty->display('index.tpl');
}
require_once 'page_shower.php';
$id = isset($_GET['pageID']) ? intval($_GET['pageID']) : 1; //oder was auch immer default ist
//$smarty erzeugen
//$db erzeugen
show_page($id);
function show_page($param) {
global $db, $smarty;
$id = $_GET['pageID'];
$_GET['id'] = $_GET['pageID'];
//$name = $_GET['pageName'];
$result = $db->query("
SELECT
pageID as id, pageNAME as pname, pageTitle as ptitle, pageContent as pcontent
FROM
d3b_pages
WHERE
pageID = '$id'
");
while($row = $db->fetch_array($result)) {
$smarty->assign('content', $row['pcontent']);
}
}
function show_page($param) {
global $db, $smarty;
$param=mysql_real_escape_string($param); //(sql-I)
$result = $db->query("
SELECT
pageContent
FROM
d3b_pages
WHERE
pageID = '$param'
LIMIT 1
");
$row = $db->fetch_array($result))
$smarty->assign('content', $row['pageContent']);
mysql_free_result($result);
}
EDIT:
noch schutz gegen sql-I ergänzt, um nicht nach DDSIG schuld zu sein.
#FUNCTION show_page // Hole die Pages aus der Datenbank
function show_page($param) {
global $db, $smarty;
$param = mysql_real_escape_string($param); //(sql-I)
$result = $db->query("
SELECT
pageTitle as title, pageContent as content
FROM
d3b_pages
WHERE
pageID = '$param'
LIMIT 1
");
$row = $db->fetch_array($result);
$db->free_result($result);
//ganze smarty-assignment-zeugs
$smarty->assign('content', $row['content']);
$smarty->assign('title', $row['title']);
//GET PageID
if(isset($_GET['pageID'])){
show_page($_GET['pageID']);
}
else{
}
//Output index.tpl
$smarty->display('index.tpl');
}//Ende Function
$pageID = isset($_GET['pageID']) ? intval($_GET['pageID']) : 1; //Seite 1 wird immer angezeigt
show_page($pageID);
{include file="pages.tpl"}
{include file="main.tpl"}
Kommentar