deadpixelstudios Posted July 25, 2012 Share Posted July 25, 2012 Hey all, First off apologies, I'm new to php and programming in general but I'm giving it a punt so here goes. I have a gallery of images on my site and they are each displayed with an add to cart button. The thing is I also want to create a download button that will appear next to the add to cart button when '$gallery->image_desc' is equal to 'Y'. I have tried the following code and don't get any errors, but the download button fails to display when '$gallery->image_desc' is equal to 'Y'. If anyone can see any way of making this happen I would be most appreciative. <div class="meta_wrapper"> <div class="addto">'; if(!$ecomm_but_image) { $insertgallery .= '<a class="iframe" id="addto_'.$gallery->id.'" href="' . photocrati_gallery_file_uri('ecomm-sizes.php') . '?prod_id='.$gallery->id.$action.'"> <button id="addto" class="positive" style="margin:0 5px;"> '.$ecomm_but_text.' </button>'; //DOWNLOAD BUTTON IF STATEMENT if ($gallery->image_desc =="Y") { '<a><button id="addtoDL" class="positive" style="margin:0 5px;">DOWNLOAD</button></a>'; } //END OF DOWNLOAD BUTTON IF STATEMENT } else { $insertgallery .= '<a class="iframe" id="addto_'.$gallery->id.'" href="' . photocrati_gallery_file_uri('ecomm-sizes.php') . '?prod_id='.$gallery->id.$action.'"> <img src="'.$ecomm_but_image.'" id="addto"> </a>'; } $insertgallery .= '</div> </div> Link to comment https://forums.phpfreaks.com/topic/266212-button-not-appearing/ Share on other sites More sharing options...
neller Posted July 25, 2012 Share Posted July 25, 2012 I think you have just forgot to add the variable part by looks of it Your current code doesnt add to a variable to echo out as u can see below.. '<a><button id="addtoDL" class="positive" style="margin:0 5px;">DOWNLOAD</button></a>'; You either need to add it to the variable you are using $insertgallery .= '<a><button id="addtoDL" class="positive" style="margin:0 5px;">DOWNLOAD</button></a>'; or echo it out echo '<a><button id="addtoDL" class="positive" style="margin:0 5px;">DOWNLOAD</button></a>'; Link to comment https://forums.phpfreaks.com/topic/266212-button-not-appearing/#findComment-1364217 Share on other sites More sharing options...
deadpixelstudios Posted July 25, 2012 Author Share Posted July 25, 2012 Thank you so much. The following worked perfectly for me $insertgallery .= '<a><button id="addtoDL" class="positive" style="margin:0 5px;">DOWNLOAD</button></a>'; Link to comment https://forums.phpfreaks.com/topic/266212-button-not-appearing/#findComment-1364223 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.