Alright guys

I am little bit confused to why this isnt working properly at the moment.. Can some one take a look and help please...?

Let me try my best to explain in detail.. Bear with me Please take a look at this page... http://www.digitalresellersvault.com/marketplace.php

This page within the membership script coding is controlled by twp pages. One php, and then another html file ( which I have changed to a php page) Because what I am done is changed the completely layout of the site...

Here is the marketplace.php code for the above page that you are looking at..

Code:
<?php
include_once ("header.php");
$cat = $_GET["cat"];
$link = $_GET["category"];
$search = $_GET["search"];
$cat_title = str_replace("_"," ",$link);

if($cat != "t")
	{
	$GetFile = file("http://www.digitalresellersvault.com/template/template.php");
	$Content = join("", $GetFile);
	$categories=$common->categories($db);
	$content=str_replace("{categories}",$categories,$content);	
	$Pat = "/<{Begin}>(.*?)<{End}>/s";
	preg_match($Pat,$Content,$Output);
	$SelectedContent = $Output[1];
	$q = "select * from ".$prefix."products where show_product = '1' ORDER BY Rand() LIMIT 1";
	$r = $db->get_a_line($q);
	$id = $r[id];
	$imageurl = $r[imageurl];
	$prod_description = $r[prod_description];
	$salesprice = $r[price];
	$product_name = $r[product_name];
	$salespage_link='<a href="prods.php?pid='.$id.'"><img border="0" src="http://www.digitalresellersvault.com/template/images/moreinfobutton.jpg" width="104" height="16"></a>';
	
			
	$prod_image ='<img src="images/'.$imageurl.'" border="0">';
	
	$Content = preg_replace($Pat,$ToReplace,$Content);
	$Content = preg_replace("/{{(.*?)}}/e", "$$1", $Content);
	echo $Content;
	include_once ("footer.php");		
	exit();		
	}


elseif($cat == "t")
	{
	$search = $_GET["search"];
	$link = $_GET["category"];
	$cat_title = str_replace("_"," ",$link);
	$GetFile = file("http://www.digitalresellersvault.com/template/template.php");
	$Content = join("", $GetFile);
	$categories=$common->categories($db);
	$content=str_replace("{categories}",$categories,$content);	
	$Pat = "/<{Begin}>(.*?)<{End}>/s";
	preg_match($Pat,$Content,$Output);
	$SelectedContent = $Output[1];

	if($search_txt != "")
		{
		$cond	= "where product_name like '%".$search_txt."%' && show_product = '1'";		
		}
	else
		{
		$cond	= "where category = '$cat_title' && show_product = '1'";
		}

	########## pagination ###########
	$q = "select count(*) as cnt from ".$prefix."products $cond";
	$r = $db->get_a_line($q);
	$count = $r[cnt];
	if($count == "0")
		{
		$warning = "No Results Found";
		}
	$records=10;
	$links="marketplace.php?cat=t&category=$link&search_txt=$search_txt&";

	if($page=="")
		{
		$page=1;
		}
	$start=($page-1)*$records;
	$Content=$common->print_page_break3($db,$Content,$count,$records,$links,$page);
	########## pagination ###########

	$ChangeColor = 1;
	$ToReplace = "";
	$GetProduct = $db->get_rsltset("select * from ".$prefix."products $cond order by id DESC limit $start, $records");
	for($i = 0; $i < count($GetProduct); $i++)
		{
		$bgcolor = "#FFFFFF";
		@extract($GetProduct[$i]);
		if($period3_interval == "D"){$interval = "Day(s)";}
		if($period3_interval == "W"){$interval = "Week(s)";}
		if($period3_interval == "M"){$interval = "Month(s)";}
		if($period3_interval == "Y"){$interval = "Year(s)";}

		if($subscription_active == "1")
			{
			$salesprice = $amount3." every ".$period3_value." ".$interval;
			}
		else
			{
			$salesprice = $price;
			}	
		$prod_image ='<img src="images/'.$imageurl.'" border="0"width="140" height="140">';
		$salespage_link='<a href="prods.php?pid='.$id.'"><img border="0" src="http://www.digitalresellersvault.com/template/images/moreinfobutton.jpg" width="104" height="16"></a>';
		$ToReplace .= preg_replace($Ptn,"$$1",$SelectedContent);
		}
	}	
		
$Content = preg_replace($Pat,$ToReplace,$Content);
$Content = preg_replace("/{{(.*?)}}/e", "$$1", $Content);
echo $Content;
include_once ("footer.php");
?>
If you look at this part of the code
Code:
$GetFile = file("http://www.digitalresellersvault.com/template/template.php");
That allows me to use the marketplace.php for the layout of the marketplace. When you click on categories it automaitcally detects the layout, etc...

The categories part are displayed using the following code
Code:
	//===================================================================================

	// catagory list
	function categories($db_domain)
		{
		include "common/config.php";
	
		$query  = "SELECT * FROM ".$prefix."category";
		$result = mysql_query($query);
		$admin_ads_top = "";
		$kk=0;
		while ($row = mysql_fetch_array($result, MYSQL_NUM))
			{	
			$kk++;
			$tr=$etr=NULL;
			
			$tr="</tr><tr>";
			
			
		
			$cat_title=$row[1];
			// Count how many products in this catagory 
			
			$qry="select count(*) as cnt from ".$prefix."products where category='$cat_title'";
			$presult = $db_domain->get_a_line($qry);
			$pcount=$presult[cnt];
			
			
			
			$link = $cat_title;
			$link 	= preg_replace('/([^a-z0-9])+/i', '_', $cat_title);
			$starttable="<li>";
			$endtable = "</li>";			
			$admin_ads_top.="$starttable <a href=marketplace.php?cat=t&category=$link>$cat_title</a> <font color=	#C91401>($pcount)$endtable</font>";			
			$tr=$etr=NULL;
			}
		$admin_ads_top.="";	
		return $admin_ads_top;
		}
	//=====================================================================================

Then to get the categories to appear in the marketplace.php we use the following code

Code:
<ul>
{{categories}}


</ul>
That is it.. I know that it is working fine on the marketplace.php.. But I just needed to make you aware of how it all worked before I got on to the issue

If you now go to http://www.digitalresellersvault.com/contact.php I have changed the layout of that site to match the marketplace.php

Code:
<?php

include_once ("header.php"); ?>
<link href="http://www.digitalresellersvault.com/template/style.css" rel="stylesheet" type="text/css">
<div id="mainbody"> <!--Begin Wrap-->

<?php include("http://www.digitalresellersvault.com/template/l_sidebar.php"); ?>
<?php include("http://www.digitalresellersvault.com/template/r_sidebar.php"); ?>


  <div id="middle"><div align="center">
    <p>How To Download Products From Digital Resellers Vault:</p>
    <p>&nbsp;</p>
  </div>
 

  <div class="productboxheader">
   
  <img src="http://www.digitalresellersvault.com/template/images/productheader.jpg" width="485" height="38" />
  
  </div>
  <div class="producttop1">
  <?php
// get contact page info from database

$q = "select * from ".$prefix."site_settings";
$v = $db->get_a_line($q);

$contact_page = $v['contact'];
$contact_page = stripslashes($contact_page);

// display contact page
$returncontent = preg_replace ("/\[\[(.*?)\]\]/e", "$$1", $contact_page);
$returncontent = preg_replace("/[$]/","&#36;",$returncontent);
echo $returncontent;

?></div>
                
 <div class="productbottom">
   </div>
  
  
   </div> 
  
  
 
  
<div style="clear: both;">
  <!-- PUT IT HERE -->
</div> <!-- end wrap--></div>



<?php include_once ("footer.php");

?>
But now the categories arent working on that page.. It just coming up with the word {{categories}} instead..

What do I need to do to get the categories to work just like it work on the marketplace.php page? Do I need to copy the code from marketplace.php??

Bearing in mind I want the categories to work exactly as it did as before..


Hopefully you guys will understand