SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot frosco's Avatar
    Join Date
    Jul 2003
    Location
    WA state
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    NO Display on empty

    Code:
        if (!empty($display_lgimage3))
    	echo "<a href=\"$URL/enc/resize.php?image=$URL/$imgname3&width=$lgimgwidth&height=lgimgheight\" rel=\"lightbox\">";
    	echo "<img src=\"$URL/enc/resize.php?image=$URL/$imgname3&height=$smimgheight&width=$smimgwidth\" title=\"$display_item\" border=\"0\">

    I'm a PHP novice, but all I am trying to accomplish is to have NOTHING display ed when $dispay_lgimage3 is empty. As it stands, the above displays the square & red "x" in it.

    I'm sure it's a quick fix, I just can't figure it. I tried putting an "else" statement but that just wrought havoc. Thanks!

  2. #2
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,396
    Mentioned
    54 Post(s)
    Tagged
    0 Thread(s)
    Because there are two lines of code intended to be within the if block, you'll need to wrap them with curly braces.

    Code:
    if (!empty($display_lgimage3)) {
    	echo "<a href=\"$URL/enc/resize.php?image=$URL/$imgname3&width=$lgimgwidth&height=lgimgheight\" rel=\"lightbox\">";
    	echo "<img src=\"$URL/enc/resize.php?image=$URL/$imgname3&height=$smimgheight&width=$smimgwidth\" title=\"$display_item\" border=\"0\">";
    }
    Salathe
    Software Developer and PHP Manual Author.

  3. #3
    SitePoint Zealot frosco's Avatar
    Join Date
    Jul 2003
    Location
    WA state
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahhh...thank you!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •