Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-15-2010, 03:10 AM   PM User | #1
Byronwells
Regular Coder

 
Join Date: Dec 2009
Posts: 240
Thanks: 7
Thanked 0 Times in 0 Posts
Byronwells can only hope to improve
How Do I Add This Bit Of Code?????

Alright Guys

I have created a new db field called download_link and have linked it to the add products page. That is working fine. The information that is stored in that field is the filename and extention ie. text.zip

I have then attempted to get the information display on this page.. http://www.digitalresellersvault.com...ategory=demo_1 look under the demo 3 product

What I am trying to do is to get it to display in a url format. So all I need to do is add the file name on the add products page, then on the marketplace it will add it to a url link, and then display it..

The url link is suppose to look like this

<a href="http://www.digitalresellersvault.com/go/downloads/ "file name goes here"


I have tried all sort of cobinmations but all I can get to display is the filename, not a url link..

This is the code that I am using now

$download_link='<a href="http://www.digitalresellersvault.com/go/downloads/'$r[download_link]."></a>';
Byronwells is offline   Reply With Quote
Old 02-15-2010, 04:03 AM   PM User | #2
MattF
Senior Coder

 
Join Date: Jul 2009
Location: South Yorkshire, England
Posts: 2,322
Thanks: 6
Thanked 304 Times in 303 Posts
MattF will become famous soon enoughMattF will become famous soon enough
Something along the lines of:

Code:
$download_link = '<a href="http://www.digitalresellersvault.com/go/downloads/'.$r[download_link].'">'.$filename.'</a>';
MattF is offline   Reply With Quote
Old 02-15-2010, 04:28 AM   PM User | #3
Byronwells
Regular Coder

 
Join Date: Dec 2009
Posts: 240
Thanks: 7
Thanked 0 Times in 0 Posts
Byronwells can only hope to improve
Quote:
Originally Posted by MattF View Post
Something along the lines of:

Code:
$download_link = '<a href="http://www.digitalresellersvault.com/go/downloads/'.$r[download_link].'">'.$filename.'</a>';
Where did you get the $filename from please??

I have not created that part
Byronwells is offline   Reply With Quote
Old 02-15-2010, 05:56 AM   PM User | #4
MattF
Senior Coder

 
Join Date: Jul 2009
Location: South Yorkshire, England
Posts: 2,322
Thanks: 6
Thanked 304 Times in 303 Posts
MattF will become famous soon enoughMattF will become famous soon enough
Quote:
Originally Posted by Byronwells View Post
Where did you get the $filename from please??

I have not created that part
Replace $filename with whatever you want to show as the link text. That was merely an example.
MattF is offline   Reply With Quote
Old 02-15-2010, 06:02 AM   PM User | #5
Len Whistler
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
Len Whistler is on a distinguished road
Also check the browser source code , View/Page Source with FireFox.
  • What is missing?
  • How can you correct the code to make the link work?



---------------
__________________
Leonard Whistler
Len Whistler is offline   Reply With Quote
Old 02-15-2010, 06:26 AM   PM User | #6
Byronwells
Regular Coder

 
Join Date: Dec 2009
Posts: 240
Thanks: 7
Thanked 0 Times in 0 Posts
Byronwells can only hope to improve
Quote:
Originally Posted by Len Whistler View Post
Also check the browser source code , View/Page Source with FireFox.
  • What is missing?
  • How can you correct the code to make the link work?



---------------
Len

I already know what is missing.. That is why I am here asking you how to get that part to display/work correctly....
Byronwells is offline   Reply With Quote
Old 02-15-2010, 06:27 AM   PM User | #7
Byronwells
Regular Coder

 
Join Date: Dec 2009
Posts: 240
Thanks: 7
Thanked 0 Times in 0 Posts
Byronwells can only hope to improve
Quote:
Originally Posted by MattF View Post
Replace $filename with whatever you want to show as the link text. That was merely an example.
I thought so.. But when I did that nothing was displayed...
Byronwells is offline   Reply With Quote
Old 02-15-2010, 06:33 AM   PM User | #8
Byronwells
Regular Coder

 
Join Date: Dec 2009
Posts: 240
Thanks: 7
Thanked 0 Times in 0 Posts
Byronwells can only hope to improve
Quote:
Originally Posted by MattF View Post
Something along the lines of:

Code:
$download_link = '<a href="http://www.digitalresellersvault.com/go/downloads/'.$r[download_link].'">'.$filename.'</a>';
Here is the full marketplace.php code

Code:
<?php
include_once "include.php";
$hash=$_COOKIE["memcookie"];
$memberid=$common->check_session($hash,$db);
if($memberid != "")
	{
	include_once("session.php");
	}

$GetFile = file("http://www.digitalresellersvault.com/template/header.php");
$Content = join("",$GetFile);
ob_start();

$q = "select sitename, description, keywords, bgimage, bgcolor, header, meta, footer from ".$prefix."site_settings where id='1'";
$r = $db->get_a_line($q);
@extract($r);
$meta = stripslashes($meta);
if($header != "")
	{
	$headers='<img src="../'.$header.'" border="0">';
	}
if($bgimage != "")
	{
	$bgimage1='background ="../'.$bgimage.'"';
	}
if($footer != "")
	{
	$footers='<img src="../'.$footer.'" border="0">';
	}

// Get Menus
$q = "select * from ".$prefix."site_menus where id=1";
$r = $db->get_a_line($q);
@extract($r);
$member_menu=stripslashes($r["member_menu"]);
$jv_menu=stripslashes($r["jv_menu"]);
	
// Get the member user id
$q = "select * from ".$prefix."members where id='$memberid'" ;
$r = $db->get_a_line($q);
@extract($r);
$jv_status		= $r[jv_status];
if ($jv_status !=1)
	{
	$jv_menu="";
	}
if ($jv_status ==1)
	{
	$jvlink ="<a href=../jv/index.php>JV Partner Area</a>";	
	}	

// Get top and bottom ads
$q = "select * from ".$prefix."ad_blocks where id='1'" ;
$r = $db->get_a_line($q);
@extract($r);
$top_ad				= $r[top_ad];
$bottom_ad			= $r[bottom_ad];

// Display text ads
$admin_ads_top=$common->adminadstop($db);
$content=str_replace("{admin_ads_top}",$admin_ads_top,$content);
$admin_ads_bottom=$common->adminadstop($db);
$content=str_replace("{admin_ads_bottom}",$admin_ads_bottom,$content);
$jv_ads_top=$common->jvads($db);
$content=str_replace("{jv_ads_top}",$jv_ads_top,$content);
$jv_ads_bottom=$common->jvads($db);
$content=str_replace("{jv_ads_bottom}",$jv_ads_bottom,$content);

// Parse content
$member_menu	= preg_replace("/\[\[(.*?)\]\]/e","$$1",$member_menu);
$top_ad 		= preg_replace ("/\[\[(.*?)\]\]/e", "$$1", $top_ad);
$bottom_ad 		= preg_replace ("/\[\[(.*?)\]\]/e", "$$1", $bottom_ad);
$Content 		= preg_replace("/{{(.*?)}}/e","$$1",$Content);
$Content 		= preg_replace("/<{(.*?)}>/e","$$1",$Content);
echo $Content;
?>
The layout of the marketplace is this page...
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">
  <div class="productboxtitle">
  PRODUCT DOWNLOADS
  </div> 
  
  
  </div>
  <div class="producttop1">
    <{Begin}>
    
    </div>
  <div class="producttop"> 

 
  <div class="datebox">
    
    <div align="center">Added:<br />
 {{formatteddate}}</div>
  </div>
    <div class="producttitle">{{product_name}}</div>
  <div class="productlicense">({{product_licence}} Included)</div>
<div class="productdashline">
</div>  
<div class="productimage">

  <div align="center">{{prod_image}}</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">
      {{filename}}</div>
   
    <div class="moreinfobox">
    {{salespage_link}}  
    </div>
    <div class="viewsalespagebox"> 
   
      <img src="http://www.digitalresellersvault.com/template/images/viewsalespagebutton.jpg" width="113" height="15" /> </div> 
      
     </div>   
  

      
   <div class="producttop1">
    
   <{End}>
	</div>
    
     <div class="producttop1">
   	Page __single__ __first__ __previous__ &nbsp; 
		<{page_loopstart}>
			<{page1}> &nbsp;
		<{page_loopend}>
		__next__ __last__
        </div>
               
 <div class="productbottom">
   </div>
  
  
   </div> 
  
  
 
  
<div style="clear: both;">
  <!-- PUT IT HERE -->
</div> <!-- end wrap--></div>
Byronwells is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:58 AM.


Advertisement
Log in to turn off these ads.