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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.