Affiliate Marketing
Forum Search


Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 03-01-07
Registered User
 
Join Date: Aug 2003
Location: Cornwall
Posts: 209
Thanks: 0
Thanked 0 Times in 0 Posts
Melter is an unknown quantity at this point
  Using sample image where datafeeds don't provide one

I'm using datafeeds to display products and of course not every product comes with an image. This leaves me with a problem where the products with images get thrown out of line because of the ones without. So I want to place a sample image where a product doesn't have one. Below is a sample of the php used to display the products so can anyone help with this please?

Code:
<a href="<?php echo $row_Recordset1['deepLink']; ?>&amp;clickref=<?php echo $row_Recordset1['brand']; ?>" target="_blank">
      <img src="<? echo $row_Recordset1['imageURL']; ?>" height="90" width="90" alt="<?php echo $row_Recordset1['brand']; ?>" title="<?php echo $row_Recordset1['name']; ?>" border="0" align="top" /></a><br />
      
      <?php if($row_Recordset1['currency'] == 'GBP') echo '£'; echo $row_Recordset1['searchPrice']; ?><br />
      <a href="<?php echo $row_Recordset1['deepLink']; ?>&amp;clickref=<?php echo $row_Recordset1['brand']; ?>" target="_blank"><b>Buy This Now</b></a>
      </div>
      <?php if ($i >= 6) /* column count */ break; $row_Recordset1 = mysql_fetch_assoc($Recordset1); } ?>
      <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
__________________
Lcd Tv Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-01-07
1BIZLIST's Avatar
In need of a mentor!
 
Join Date: Mar 2006
Posts: 297
Thanks: 0
Thanked 0 Times in 0 Posts
1BIZLIST is an unknown quantity at this point
  Re: Using sample image where datafeeds don't provide one

I haven't looked through your code but you could possibly try using something like this

PHP Code:
if (url_exists($query_data[0])){
echo 
'<a href="affiliatelink" rel="nofollow"><img src="$query_data[0]" border="0" /></a>';
}else
{
echo 
'<a href="affiliatelink" rel="nofollow"><img src="/images/no_picture.gif" border="0" /></a>';

Where $query_data[0] is the field from the feed for the image (personally I always store this info in a database), if the image doesnt exist then it uses a default image.

HTH

Mark.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-01-07
Registered User
 
Join Date: Aug 2003
Location: Cornwall
Posts: 209
Thanks: 0
Thanked 0 Times in 0 Posts
Melter is an unknown quantity at this point
  Re: Using sample image where datafeeds don't provide one

Okay tried that and I'm just getting syntax errors. Here's the updated code (new bit in red) if anyone can see where I'm going wrong. Thanks for the help so far.
Code:
<?php if (url_exists($row_Recordset1['imageURL'])){
      echo '<a href="<?php echo $row_Recordset1['deepLink']; ?>&amp;clickref=<?php echo $row_Recordset1['brand']; ?>" target="_blank">
      <img src="<? echo $row_Recordset1['imageURL']; ?>" height="90" width="90" alt="<?php echo $row_Recordset1['brand']; ?>" title="<?php echo $row_Recordset1['name']; ?>" border="0" align="top" /></a>';<br />
      }else{
      echo '<a href="<?php echo $row_Recordset1['deepLink']; ?>&amp;clickref=<?php echo $row_Recordset1['brand']; ?>" target="_blank">
      <img src="images/noimage.jpg" height="90" width="90" alt="<?php echo $row_Recordset1['brand']; ?> " title="<?php echo $row_Recordset1['name']; ?>" border="0" align="top" /></a>'; }
      ?><br />
      <?php if($row_Recordset1['currency'] == 'GBP') echo '£'; echo $row_Recordset1['searchPrice']; ?><br />
      <a href="<?php echo $row_Recordset1['deepLink']; ?>&amp;clickref=<?php echo $row_Recordset1['brand']; ?>" target="_blank"><b>Buy This Now</b></a>
      </div>
      <?php if ($i >= 6) /* column count */ break; $row_Recordset1 = mysql_fetch_assoc($Recordset1); } ?>
      <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
__________________
Lcd Tv Forum

Last edited by Melter; 03-01-07 at 05:51 PM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-01-07
Dark Prince
 
Join Date: Aug 2003
Location: Moving to Windsor Woohoo!
Posts: 1,570
Thanks: 0
Thanked 9 Times in 7 Posts
lowndsy is an unknown quantity at this point
  Re: Using sample image where datafeeds don't provide one

Looks like you forgot to close the ELSE with a } after all the skipping in and out of php and html.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #5 (permalink)  
Old 03-01-07
Registered User
 
Join Date: Aug 2003
Location: Cornwall
Posts: 209
Thanks: 0
Thanked 0 Times in 0 Posts
Melter is an unknown quantity at this point
  Re: Using sample image where datafeeds don't provide one

You're right but I've added that now and still getting syntax errors.
__________________
Lcd Tv Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 03-01-07
1BIZLIST's Avatar
In need of a mentor!
 
Join Date: Mar 2006
Posts: 297
Thanks: 0
Thanked 0 Times in 0 Posts
1BIZLIST is an unknown quantity at this point
  Re: Using sample image where datafeeds don't provide one

What errors are you getting mate?

Wouldn't it be easier to stay in php and echo all the html statements?

Mark.

EDIT:

?php if (url_exists($row_Recordset1['imageURL'])){
echo '<a href="<?php echo $row_Recordset1['deepLink']; ?>&amp;clickref=<?php echo $row_Recordset1['brand']; ?>" target="_blank">
<img src="<? echo $row_Recordset1['imageURL']; ?>" height="90" width="90" alt="<?php echo $row_Recordset1['brand']; ?>" title="<?php echo $row_Recordset1['name']; ?>" border="0" align="top" /></a>';<br />
}else{
echo '<a href="<?php echo $row_Recordset1['deepLink']; ?>&amp;clickref=<?php echo $row_Recordset1['brand']; ?>" target="_blank">
<img src="images/noimage.jpg" height="90" width="90" alt="<?php echo $row_Recordset1['brand']; ?> " title="<?php echo $row_Recordset1['name']; ?>" border="0" align="top" /></a>'; }
?

Think I might have highlighted the problem by bolding one instance above.

Mark
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-01-07
1BIZLIST's Avatar
In need of a mentor!
 
Join Date: Mar 2006
Posts: 297
Thanks: 0
Thanked 0 Times in 0 Posts
1BIZLIST is an unknown quantity at this point
  Re: Using sample image where datafeeds don't provide one

Just looking at the code again, maybe that's not the problem afterall, it's just too hard to see with all the popping in and out of php, it's so much easier to read staying in php and using code like this:

PHP Code:
<?php if (url_exists($row_Recordset1['imageURL']))
{
      echo 
'<a href="'.$row_Recordset1[deepLink].'&amp;clickref='.$row_Recordset1[brand]." target="_blank">
}
Post the errors and I will take a look

Mark.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #8 (permalink)  
Old 03-01-07
Registered User
 
Join Date: Aug 2003
Location: Cornwall
Posts: 209
Thanks: 0
Thanked 0 Times in 0 Posts
Melter is an unknown quantity at this point
  Re: Using sample image where datafeeds don't provide one

I see what you're both saying but the existing code worked fine it's just gone haywire with the changes. However just to make certain I removed the unnecessary bits and am getting the same error, which is:
Quote:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' on line...
__________________
Lcd Tv Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 03-01-07
1BIZLIST's Avatar
In need of a mentor!
 
Join Date: Mar 2006
Posts: 297
Thanks: 0
Thanked 0 Times in 0 Posts
1BIZLIST is an unknown quantity at this point
  Re: Using sample image where datafeeds don't provide one

Okay, can you stick the code from that line up for us?

Mark.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 03-01-07
Registered User
 
Join Date: Aug 2003
Location: Cornwall
Posts: 209
Thanks: 0
Thanked 0 Times in 0 Posts
Melter is an unknown quantity at this point
  Re: Using sample image where datafeeds don't provide one

This seems to be the one.
Quote:
<img src="'.$row_Recordset1[imageURL].'" height="90" width="90" alt="'.$row_Recordset1[brand].'" title="'.$row_Recordset1[name].'" border="0" align="top" /></a>'; <br />
__________________
Lcd Tv Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #11 (permalink)  
Old 04-01-07