Author Topic: help needed - if else query with images  (Read 144 times)

0 Members and 1 Guest are viewing this topic.

Offline rsteposTopic starter

  • Irregular
    • View Profile
help needed - if else query with images
« on: February 08, 2010, 12:06:00 PM »
if( _SHOW_PRICES && $auth['show_prices'] ) {
	
	
	
$data[$row][] = $product['product_price'];
	
	
}
	
	
$data[$row][] = '<a href="'.$product['product_flypage'].'" title="'.$product['product_name'].'">'
	
	
	
	
	
	
ps_product::image_tag$product['product_thumb_image'] )
	
	
	
	
	
	
'</a>';
	
	
$data[$row][] = $product['product_s_desc'];
	
	
if( 
$product['has_addtocart'] ) {
	
	
	
$data[$row][] = $product['form_addtocart'];
	
	
}
	
	
else {
	
	
	
$data[$row][] = '<a href="'.$product['product_flypage'].'" title="'.$product['product_name'].'">'
	
	
	
<
div style="background-image:url(./~ladolcev/components/com_virtuemart/themes/default/images/add-to-cart_blue.jpeg);background-repeat:no-repeat;height:27px;width:140px;font-weight:bold;padding-left:7px;padding-top:5px;
	
	
	
	
	

	
	
	
	
	

	
	
	
	
	
	
</div>


	
	
}
	
	

	
	
$row++;
	
	

}


this is what i have entered but i dont seem to be getting anywhere?! any ideas to get this working?

Offline MrAdam

  • Addict
  • Gender: Male
    • View Profile
    • My Portfolio
Re: help needed - if else query with images
« Reply #1 on: February 08, 2010, 12:08:33 PM »
.. Where are you wanting to go?

Offline rsteposTopic starter

  • Irregular
    • View Profile
Re: help needed - if else query with images
« Reply #2 on: February 08, 2010, 04:49:46 PM »
basically my issue is with the <div section after else

i want an image displayed to the right of each entry that will be pulled from the database but i keep getting a multitude of errors displayed. This image will be clicked upon by vistors to the site which will take them to a product details page.

any help will be very much appreciated!!  :D

Offline brainstorm316

  • Irregular
    • View Profile
Re: help needed - if else query with images
« Reply #3 on: February 08, 2010, 05:01:32 PM »
I know this may be a really stupid answer, it may just be the fact that this forum only allows a certain width of post... but ...


	


<
div style="background-image:url(./~ladolcev/components/com_virtuemart/themes/default/images/add-to-cart_blue.jpeg);background-repeat:no-repeat;height:27px;width:140px;font-weight:bold;padding-left:7px;padding-top:5px;



isn't closed...

should be:



<div style="background-image:url(./~ladolcev/components/com_virtuemart/themes/default/images/add-to-cart_blue.jpeg);background-repeat:no-repeat;height:27px;width:140px;font-weight:bold;padding-left:7px;padding-top:5px;">


Offline rsteposTopic starter

  • Irregular
    • View Profile
Re: help needed - if else query with images
« Reply #4 on: February 09, 2010, 04:40:55 AM »
completely missed the > to close the div but unfortunately im now getting

Parse error: syntax error, unexpected T_STRING in /home/ladolcev/public_html/components/com_virtuemart/themes/default/templates/browse/includes/browse_listtable.tpl.php on line 61

which is that same div line  :confused:

Offline MrAdam

  • Addict
  • Gender: Male
    • View Profile
    • My Portfolio
Re: help needed - if else query with images
« Reply #5 on: February 09, 2010, 04:49:10 AM »
That's because you're closing the string on the previous line. Move the single quote on the end of the previous line to after </div> followed by a semicolon.
« Last Edit: February 09, 2010, 04:50:02 AM by MrAdam »

Offline rsteposTopic starter

  • Irregular
    • View Profile
Re: help needed - if else query with images
« Reply #6 on: February 09, 2010, 05:30:51 AM »
thanks mr adam that solved the error but the image is not displaying on the page once it loads  :confused: i am now wondering if it is because this is generating a html table to display the data?? completely no idea
here is a screen shot of what i now have


basically i am looking for the image to be displayed to the right of the first three products as the must be customised

thanks again guys this has to be one of the best forums  :D

Offline MrAdam

  • Addict
  • Gender: Male
    • View Profile
    • My Portfolio
Re: help needed - if else query with images
« Reply #7 on: February 09, 2010, 05:41:47 AM »
That's because you're div tags are empty. If you were to force white space with &nbsp; you should see it appear. Would an <img /> tag not be better suited here though?

Offline rsteposTopic starter

  • Irregular
    • View Profile
Re: help needed - if else query with images
« Reply #8 on: February 09, 2010, 06:06:30 AM »
i'm kind of flying blind here, this is my first real go at php, how would i go about implementing an /img tag? sorry for the lame question!!  :-\

Offline MrAdam

  • Addict
  • Gender: Male
    • View Profile
    • My Portfolio
Re: help needed - if else query with images
« Reply #9 on: February 09, 2010, 06:33:55 AM »
This is now a HTML error, not PHP. The reason your image isn't showing is because you're applying it as a background image in a empty div - which because it's empty isn't showing. You can 'force' it to display by adding in whitespace with &nbsp; (remember normal whitespace is ignored by default in HTML).

As I was saying however, a normal HTML image tag seems like it would be better suited here.

Offline rsteposTopic starter

  • Irregular
    • View Profile
Re: help needed - if else query with images
« Reply #10 on: February 09, 2010, 07:31:16 AM »
mr adam you are the man, have now got the image displaying simply using the img tag only issue is that it is a little further to the right than the add to cart images but i suppose i could edit the white space to make it longer in photoshop or something. I'll give it a go and report back but thanks again

Offline rsteposTopic starter

  • Irregular
    • View Profile
Re: help needed - if else query with images
« Reply #11 on: February 09, 2010, 07:32:55 AM »
 :D :D  :D
mr adam thanks!!! problem solved, would never have got there without your help man thanks   ;)

PHP Freaks Forums

« on: »

Tired of these ads? Purchase a supporter subscription to get rid of them.