Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

Help please : Php template system

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

shahzad11

Account Suspended
Impact
11
I am developing a template based site written in php+mysql i have arranged all the things but now i wanna display my data from sql and display via my template but it gives errors to me

please suggest me the right method


here are my

files attacher with



my index file code

<?php require_once('Connections/songs.php'); ?>
<?
$username="******";
$password="******";
$database="******";

mysql_connect("localhost",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM songs ";
$result=mysql_query($query);
$rowresult = mysql_fetch_assoc($result);


$num=mysql_numrows($result);

mysql_close();


?>
<?php

require "template.class.php";
require "config.php";
$tpl->file("design.html");

$tpl->replacement(array(

// head tags defined//
"pagetitle" => "$pagetitle",
"keywords" => "$keywords",
"description" => "$description",
//-----------------------------//

// nav bar tabs construction//
"tab6" => '<div id="nav-tabs"><a href="http://www.urparadise.com">SMS Site</a> </div>',
"tab5" => '<div id="nav-tabs"><a href="video-songs.php">Video songs </a> </div>',
"tab4" => '<div id="nav-tabs"><a href="eng-songs.php">English songs </a> </div>',
"tab3" => '<div id="nav-tabs"><a href="indian-songs.php">Indian songs </a> </div>',
"tab2" => '<div id="nav-tabs"><a href="paki-songs.php">Paki songs </a> </div>',
"tab1" => '<div id="current-tab"><a href="index.php">Home</a> </div>',
//----------------------------------//

//header ad place//
"header-ad" => "$headerad",
//-------------------//


// submit form is here
"contents" => " ",

//------------------------------------------------------------------------------------------//
"nav" => "$nav",
"header" => "$header",
"slogan" => "$slogan",
"footer" => "$footer",


));

$tpl->display();

?>
<table width="100%" border="1px" align="center" cellpadding="3" cellspacing="0" bordercolor="#FFCC00">
<tr>

<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<? $i=0; while ($i < $num) {?>

<tr>
<td><?php echo $rowresult['title']; ?></td>
<td><a href="<?php echo $rowresult['url']; ?>"><?php echo $rowresult['url']; ?></a></td>
<td><?php echo $rowresult['type']; ?></td>
<td><?php echo $rowresult['album']; ?></td>
<td><?php echo $rowresult['singer']; ?></td>
<td><?php echo $rowresult['movie']; ?></td>
<td><?php echo $rowresult['id']; ?></td>
</tr>
<? $i++; }?></table>


here is my config.php code

<?

//Meta tags can be edited here//--
$pagetitle="Get free ringtones free wallpapers free gsm codes";
$keywords="ringtones, wallpapers, songs";
$description="ringtones, wallpapers, songs";


// main navigation bar is built here//--

$nav='<a href="index.php">Home</a> | <a href="products.php">Products</a> | <a href="links.php">Links</a> | <a href="about-us.php">About Us</a> | <a href="contact-us.php">Contact Us</a>';
//----------------------------------------------------------------------------------------//


//change your header name//--

$header="Ur Paradise";
$headerad='<div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-0882793319829430";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
//2007-09-11: urparadise.com
google_ad_channel = "5439651693";
google_color_border = "0066cc";
google_color_bg = "FFFFFF";
google_color_link = "ff6600";
google_color_text = "0066cc";
google_color_url = "008000";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>


</div>';


//----------------------------------------------------------------------------------------//

$slogan = "The Technology Blog";
$footer = "[email protected]" ;
//----------------------------------------------------------------------------------------//

$contents= "";




?>

here is my template class code

<?php

//-----------------------------------------------------------------
// Template System Class
// Made by Adrian Crepaz at Dreamit.co.uk

// Feel free to use this code in your own scripts.
// For information on how to use the Class, see here, http://www.dreamit.co.uk/php-template-system-class/
// Please do not re-distribute this code seperatly, or as your own
//-----------------------------------------------------------------

class Tpl
{
var $file;

function file($user_file)
{
if(file_exists($user_file))
{
$this->file = file_get_contents("" . $user_file . "");
}
else
{
die ("Sorry, the following file, " . $user_file . " could not be found.");
}
}

function replacement($tags = array())
{
if(count($tags) == 0)
{
die ("No tags defined for Template Tag replacement.");
}
else
{
foreach($tags AS $tag => $replace)
{
$this->file = str_replace("{" . $tag . "}", $replace, $this->file);
}
}
}

function display()
{
echo $this->file;
}
}

$tpl = new tpl;

?>

here is my template design

<!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>{pagetitle}</title>
<meta name="keywords" content="{keywords}" />
<meta name="description" content="{description}" />

<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="777" height="535" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="85" colspan="3" valign="top" class="header">{header}</td>
<td width="50"> </td>
<td width="470" valign="middle"><div align="right">{header-ad}</div></td>
<td width="7"> </td>
</tr>
<tr>
<td width="135" height="8"></td>
<td width="15"></td>
<td width="100"></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="23" colspan="6" align="center">
{tab6} {tab5} {tab4} {tab3} {tab2} {tab1} </td>
</tr>
<tr>
<td height="13" colspan="6" valign="top" class="tab-bottom-bar"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="14"></td>
<td></td>
<td></td>
<td valign="top"></td>
<td valign="top"></td>
<td></td>
</tr>
<tr>
<td height="392" valign="top"><!--DWLayoutEmptyCell--> </td>
<td valign="top"> </td>
<td colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="627" height="392" valign="top"><p>{contents}</p>
<p> </p></td>
</tr>
</table> </td>
</tr>
</table>
<table width="777" align="center">
<tr>
<td class="copy-rights">{footer}</td>
</tr></table>
</body>
</html>
 
Last edited by a moderator:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Appraise.net

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

New in Parking: updated way to act on many domains or inquiries at once
Your domain list and inquiry list now have a bar above and below the list. Check the items you want, then choose an action in the bar...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back