Jump to content

Only display when there is something there!


latempest

Recommended Posts

HELP,

I had some custom code written by a developer who is now unreachable. Part of the code creates a link to a document:

 

foreach ($prop->epcs as $epc){

$html = $html . sprintf('<p><a href="%s">View EPC</a></p>',(string)$epc->epc);

}

 

The code is using an XML feed to poluate a property database. The issue I have is that this piece of code is generating a link even if there is no document present. I need it to only display the link if there is a value in the $epcs / $epc variable.

 

Can anyone provide a piece of updated code that will only output the link if there is a value?

 

Hope that makes sense!

 

Thanks

 

Lee

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.