Jump to content

help needed - if else query with images


rstepos

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/191381-help-needed-if-else-query-with-images/
Share on other sites

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

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

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:

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

2qu6ln6.jpg

 

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

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   (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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.