Hi there,
I have a html layout stored in mysql database and i want to use php code to read the html and replace the bb code with proper html/php functions
here is the html code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>NaTo- The North Atlantic Treaty Organization - </title>
</head>
<style type="text/css">
body
{
background-color:#890303;
}
#container
{
width:936px;
height:800px;
float:left;
}
#headerleft
{
width:936px;
height:482px;
float:left;
background-image:url(images/header.gif);
background-repeat:repeat;
}
.L
{
margin-top:125px;
margin-left:10px;
color:#000000;
}
#Login
{
width:452px;
height:223px;
float:left;
background-image:url(images/newlayout_complete_02.gif);
background-repeat:no-repeat;
}
.d
{
margin-left:120px;
margin-top:50px;
}
.e
{
margin-left:120px;
margin-top:105px;
}
#newmem
{
width:484px;
height:223px;
float:left;
background-image:url(images/newlayout_complete_03.gif);
background-repeat:no-repeat;
}
#navname
{
width:245px;
height:41px;
float:left;
}
#nav
{
width:228px;
background-image:url(images/navbg_07.gif);
background-repeat:repeat;
float:left;
height:741px;
}
#navpanel
{
width:228px;
float:left;
}
.n
{
margin-top:10px;
margin-left:95px;
}
#content
{
width:691px;
float:left;
background-image:url(images/cntbg_06.gif);
background-repeat:repeat;
min-height:782px;
}
#footer
{
width:936px;
height:45px;
float:left;
}
#navfooter
{
width:145px;
height:45px;
float:left;
}
#cnt
{
width:691px;
height:56px;
float:left;
}
#allance
{
margin-left:750px;
margin-top:110px;
}
#navf
{
float:left;
}
</style>
<body>
<div id="container">
<div id="headerleft">
<div id="allance">NO Clan Alliances</div>
</div>
<div id="Login">
<div class="d"><form method="post" action="index.php?cmd=login">
<table>
<tr>
<th>Username:</th>
<th><input type="text" name="username" value="" /></th>
</tr>
<tr>
<th>Password:</th>
<th><input type="password" name="password" value="" /></th>
</tr>
<tr>
<th><input type="submit" name="login" value="Login" /></th>
</tr>
</table>
</form>
</div>
</div>
<div id="newmem">
<div class="e">[newmemb]</div>
</div>
<div id="navpanel">
<div id="navname"><img src="images/navtitle_05.gif" width="228" height="41" alt=""></div>
<div id="nav">
<div class="n"><table>
<tr>
<th><a href="index.php?cmd=Home">Home</a></th>
</tr>
<tr>
<th><a href="members.php">Console</a></th>
</tr>
<tr>
<th><a href="index.php?cmd=Members">Members</a></th>
</tr>
<tr>
<th><a href="index.php?cmd=Ranks">Ranks</a></th>
</tr>
<tr>
<th><a href="index.php?cmd=diplomacy">Allances</a></th>
</tr>
<tr>
<th><a href="index.php?cmd=medals">Medals</a></th>
</tr>
<tr>
<th><a href="punbb/index.php">Forum</a></th>
</tr>
</table>
[musicplayer]
</div>
</div>
</div>
<div id="content">
<div class="n">
The php code
function musicplayer()
{
echo "Music Player";
}
function newmem()
{
echo "New Member";
}
//
function template()
{
include("dbconnect.php");
$kQuery="SELECT * FROM template Where selected='1'";
$rs=mysqli_query($con,$kQuery);
if(!$rs)
{
echo "Error:".mysqli_error($con);
}
else
{
$count=mysqli_num_rows($rs);
if($count>0)
{
$data=mysqli_fetch_assoc($rs);
extract($data);
$Header=stripslashes($Header);
//
$n="[newmemb]";
$genav=newmem();
//$Header=str_replace($n,$genav,Header);
$a="[musicplayer]";
$ge=musicplayer();
$aPlaceholders = array('[newmemb]','[musicplayer]');
$aReplacements = array($genav,$ge);
echo str_replace($aPlaceholders, $aReplacements, $Header);
//
}
else
{
echo " Error:The Header you are Looking for cannot be found";
}
}
}
So what is wrong with my php code??
Can anyone help me with my php error? as its not being displayed correctly above.
Thanks,William