...

View Full Version : Where Do I PUT THIS BIT OF CODE, PLEASE?



Byronwells
01-24-2010, 01:13 AM
Alright guys

I am using this bit of code to automatically display the categories from the mysql database on this site http://www.digitalresellersvault.com/marketplace.php?cat=t&category=Private_Label_Rights



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");
?>


For me to get it to work on this page.. http://www.digitalresellersvault.com/contact.php

I have been told to put this snippet of code in from above


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'";
}


But when I do it doesnt work at all...

Also I have been told to change the sidebar command from include to fread...

Totally confused

This is the full page/code that I need to add it to


<?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");

?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum