Jump to content

I am CONFUSED.. Can someone help please?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
byronwells

byronwells

    Learning Programmer

  • Members
  • PipPipPip
  • 58 posts
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... Untitled Document

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..



<?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="http://forum.codecall.net/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="http://forum.codecall.net/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


$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


	//===================================================================================


	// 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



<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 Untitled Document I have changed the layout of that site to match the marketplace.php



<?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> </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("/[$]/","$",$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

#2
Feral

Feral

    Programmer

  • Members
  • PipPipPipPip
  • 162 posts
Basically yes, you need to
1.) use fread to get the sidebar instead of include
2.) copy the code from the other page
[code]
if($cat != 't')
elseif($cat == 't')
[code]

because that is the what replaces the {category} with the actual category list.

#3
byronwells

byronwells

    Learning Programmer

  • Members
  • PipPipPip
  • 58 posts

Feral said:

Basically yes, you need to
1.) use fread to get the sidebar instead of include
2.) copy the code from the other page
[code]
if($cat != 't')
elseif($cat == 't')
[code]

because that is the what replaces the {category} with the actual category list.

Sorry what do you mean to use fread to get the sidebars instead of include??