close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Show image if exists

Thread began 4/13/2010 9:11 am by MikeH | Last modified 5/31/2010 3:26 am by MikeH | 2210 views | 8 replies |

MikeH

Show image if exists

Hi
Im using the new UE + DFP extension for the first time after using ADDT (Interakts) extension for this previously.

Problem is in the old ADDT there was a Show if file exist behaviour but in DFP there is not so any ideas how to make the image show only if it exists otherwise do something else ie show a default image or just simply "no image available"

the code for displaying my image is

<img src="../uploaded_images/thumbs/<?php echo $row_WADAproducts['ProductThumb']; ?>" alt="<?php echo $row_WADAproducts['ProductName']; ?>" width="120" border="1" />

Is there an amendement I can make to do this check?

Thanks

Mike

Sign in to reply to this post

MikeH

Right changed the code to this:

<?php
if (file_exists("../uploaded_images/thumbs/" . $row_WADAproducts['ProductThumb'])) {
?>

<img src="../uploaded_images/thumbs/<?php echo $row_WADAproducts['ProductThumb']; ?>" alt="<?php echo $row_WADAproducts['ProductName']; ?>" width="120" border="1" />

<?php
}
?>

It appears to work can anyone see any probs with the coding just in case?

Thanks

Sign in to reply to this post

Jimmy Wu

That would be the way to accomplish this. If you want to display an alternate image if that one doesn't exist, you would just have to put another image tag in an else statement.

Sign in to reply to this post

MikeH

Thanks Jimmy

Sign in to reply to this post

designgraphic

What if it is not an image

Hello there! Very helpful!

I was wondering though how to make an html item appear if there is a data to the table and make it disappear if there is not.

For example I am trying to list some company details like so:

Address: <dynamic address>
Telephone: <dynamic telephone>

I want the word "Telephone:" to disappear if the user hasn't filled his telephone.

Any ideas?

Thank you!

Sign in to reply to this post

CraigRBeta Tester

there are a few ways you could do this.

i would use a php function called strlen which returns the length of the string.

in a php if statement, use this so that if the length of the sting for the telephone number is > 0 display it, otherwise don't

Sign in to reply to this post

MikeH

Hi
Another way is (seems odd at first) if you have the Search for BOSS extension installed you will notice a section in your Add Server Behaviour called Utilities in there there is a "Show Region Utility" you can use that.

you can set it to show a region if a condition is met or not met as the case may be.

Give it a go very useful and easy to use.

Mike

Sign in to reply to this post

this_is_me

Originally Said By: designgraphic
  Hello there! Very helpful!

I want the word "Telephone:" to disappear if the user hasn't filled his telephone.

Any ideas?

Thank you!  



There is a free DW extension in DMXzone.com called advanced conditional region which creates "if" clauses automatically. Very easy to use. go?553

Sign in to reply to this post

MikeH

Hi
Similar to WA Show Region Utility difference being WA has a dropdown to select the conditions and another box to allow you to compare the first condition too.

ie x = y : x <> y

Very useful and far easier.

Mike

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...