Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Dec 2009
    Posts
    240
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Who Knows About Loop Comands?

    Alright guys

    I have having a few problems understanding some of the code of my membership script. The script is called simple member pro..

    This is what the script look like before I modified it
    http://www.ultimateresalegiveaway.co...t=t&category=1

    As you can see there are two products displayed under one category.. When you click on that category both products are shown up on the page. Both products on that page has the same layout as each other..

    I need to find the loop or whatever you call it that tells the membership script when you click on a category to display all the products with the same layout on one page..

    This is the marketplace.php code
    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("html/categories.html");
    	$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.'">Click Here For More Information</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("html/marketplace.html");
    	$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&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 asc 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">';
    		$salespage_link='<a href="prods.php?pid='.$id.'">Click Here For More Information</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");
    ?>
    I know the categories part are pulled from this html file
    [code]
    <br>
    <table width="95%" border="0" align="center">
    <tr>
    <td align="center" class="titles">
    Product Market Place </td>
    </tr>
    <tr>
    <td align="center" class="error"><b>
    {{warning}}</b></td>
    </tr>
    </table>
    <br>
    <form name="search" method="post" action="marketplace.php?cat=t">
    <table width="95%" border="0" align="center" cellpadding="2" cellspacing="0">
    <tr>
    <td width="71%" align="left" class="tbtext"></td>
    <td width="21%" align="right" class="tbtext">Search&nbsp;
    <input type="text" size="20" name="search_txt" value="{{search_txt}}" class=inputbox /></td>
    <td align="right" class="tbtext" width="8%"><input type="submit" name="submit" value=" Search " class="inputbox" /></td>
    </tr>

    </table>
    </form>







    <table align="center" width="95%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td class="tbtext" width="19%" rowspan="4" align="left" valign="top">{{categories}}</td>
    <td colspan="2" align="center" class="tbtext">Featured Product </td>
    </tr>
    <tr>
    <td colspan="2" align="left" valign="top" class="tbtext"><strong>{{product_name}}</strong></td>
    </tr>
    <tr>
    <td width="47%" align="left" valign="top" class="tbtext">{{prod_description}}</td>
    <td class="tbtext" width="34%" align="right" valign="top">{{prod_image}}</td>
    </tr>
    <tr>
    <td class="tbtext" align="left">Price: $ {{salesprice}} </td>
    <td class="tbtext" align="right">{{salespage_link}}</td>
    </tr>
    <tr>
    <td class="tbtext" align="left" valign="top">&nbsp;</td>
    <td class="tbtext" align="left">&nbsp;</td>
    <td class="tbtext" align="right">&nbsp;</td>
    </tr>
    </table>
    [code]

    I have modified the layout.. Not using html files to display.. I am using all php files...

    http://www.digitalresellersvault.com/marketplace.php?cat=t&category=Private_Label_Rights

    Modified code
    Code:
    <link href="http://www.digitalresellersvault.com/template/style.css" rel="stylesheet" type="text/css">
    <div id="mainbody"> <!--Begin Wrap-->
    
    <?php include("l_sidebar.php"); ?>
    <?php include("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="producttop">{{Begin}}
      
      <div class="datebox">
        
        <div align="center">Added: Dec/09/2009</div>
      </div>
        <div class="producttitle">{{product_name}}</div>
      <div class="productlicense">(Master Resale &amp; Private Label Rights Included)</div>
    <div class="productdashline">
    </div>  
    <div class="productimage">
    
      <div align="center"><img border="0" src="http://www.digitalresellersvault.com/template/images/paintingcombo200.jpg" width="123" height="150"></div>
    </div>
    <div class="productdescription">
      <table width="324" height="151">
        <tr>
          <td><div align="justify">The most important thing in every art form is to grasp the basics. One, who tries to learn an art form without knowing the basics and the origin of it, gets no success as their foundation is weak. Oil painting is an interesting form of art, but it must be understood to appreciate it and understand it well.</div></td>
        </tr>
      </table>
    </div><div class="productdashline">
    </div>
     </div>
        <div class="productbuttonsgroup">
        <div class="Downloadbox">
          <img src="http://www.digitalresellersvault.com/template/images/downloadbutton.jpg" width="104" height="16" /></div>
       
        <div class="moreinfobox"><img src="http://www.digitalresellersvault.com/template/images/moreinfobutton.jpg" width="104" height="16" />
        </div>
        <div class="viewsalespagebox"> 
        
          <img src="http://www.digitalresellersvault.com/template/images/viewsalespagebutton.jpg" width="113" height="15" /></div>{{End}} 
          
         </div>
    
          
         
           
     <div class="productbottom">
       </div>
      
      
       </div> 
      
      
     
      
    <div style="clear: both;">
      <!-- PUT IT HERE -->
    </div> <!-- end wrap--></div>
    
    </body>
    </html>

    I beleive that it has something to do with the begin and end in the html file? Am I correct??

    This is the script that I have modified

  • #2
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Quote Originally Posted by Byronwells View Post
    Alright guys
    I need to find the loop or whatever you call it that tells the membership script when you click on a category to display all the products with the same layout on one page..
    The code below would be within the while loop that gathers the database data. Might be some typos, but it should give you a starting point.

    PHP Code:
    $row[category// from database

    if ($row[category] == 3) {
    echo 
    "<div class=\"three\">";
    // cat 3 products
    }

    if (
    $row[category] == 2) {
    echo 
    "<div class=\"two\">";
    // cat 2 products
    }

    echo 
    "</div>"
    Last edited by Len Whistler; 01-14-2010 at 05:45 AM.
    Leonard Whistler

  • #3
    Regular Coder
    Join Date
    Dec 2009
    Posts
    240
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Len Whistler View Post
    The code below would be within the while loop that gathers the database data. Might be some typos, but it should give you a starting point.

    PHP Code:
    $row[category// from database

    if ($row[category] == 3) {
    echo 
    "<div class=\"three\">";
    // cat 3 products
    }

    if (
    $row[category] == 2) {
    echo 
    "<div class=\"two\">";
    // cat 2 products
    }

    echo 
    "</div>"
    Where is that code in the above??

  • #4
    Regular Coder
    Join Date
    Dec 2009
    Posts
    240
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Sorry I gave you the wrong code...

    Code:
    <br>
    <table width="95%" border="0" align="center">
    <tr>
    	<td align="center" class="titles">
    	Product Market Place	</td>
    </tr>
    <tr>
      <td align="center" class="error"><b>
    	{{warning}}</b></td>
    </tr>
    </table>
    <br>
    <form name="search" method="post" action="marketplace.php?cat=t">
    <table width="95%" border="0" align="center" cellpadding="2" cellspacing="0">
    <tr>
    	<td width="71%" align="left" class="tbtext"><a href="marketplace.php">Back To Category Listing</a></td>
    	<td width="21%" align="right" class="tbtext">Search&nbsp;
    	  <input type="text" size="20" name="search_txt" value="{{search_txt}}" class=inputbox /></td>
    	<td align="right" class="tbtext" width="8%"><input type="submit" name="submit" value=" Search " class="inputbox" /></td>
    </tr>
    </table>
    </form>
    
    <table align="center" width="95%" border="0" cellspacing="0" cellpadding="0">
      <tr>
    <td class="tbtext" width="19%" align="left" valign="top">{{categories}}</td>
    <td colspan="2" align="left" class="tbtext"><table width="95%" border="0" align="center" cellpadding="2" cellspacing="0">
      <tr bgcolor="{{bgcolor}}">
        <td colspan="2" align="left" class="tbtext">&nbsp;</td>
        <td width="26%" align="right" class="tbtext"></td>
      </tr>
          <{Begin}>
      <tr bgcolor="{{bgcolor}}">
        <td colspan="2" align="left" class="tbtext"><strong> {{product_name}} </strong></td>
        <td width="26%" align="center" class="tbtext"></td>
      </tr>
      <tr bgcolor="{{bgcolor}}">
        <td colspan="2" align="left" valign="top" class="tbtext">{{prod_description}}</td>
        <td align="right" class="tbtext">{{prod_image}}</td>
      </tr>
      <tr bgcolor="{{bgcolor}}">
        <td width="63%" align="left" class="tbtext">Price: $ {{salesprice}} </td>
        <td colspan="2" align="right" class="tbtext">{{salespage_link}}</td>
      </tr>
      <tr bgcolor="{{bgcolor}}">
        <td colspan="2" align="left" class="tbtext">&nbsp;</td>
        <td align="right" class="tbtext">&nbsp;</td>
      </tr>
    <{End}>
    </table></td>
      </tr>
    </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <table align=center width=95%>
    
    <tr>
    	<td align="right" bgColor="#FFFFFF" class="tbtext">
    		Page __single__ __first__ __previous__ &nbsp; 
    		<{page_loopstart}>
    			<{page1}> &nbsp;
    		<{page_loopend}>
    		__next__ __last__	</td>
    </tr>
    <tr>
      <td align="right" bgColor="#FFFFFF" class="tbtext">&nbsp;</td>
    </tr>
    </table>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •