How can I nest a IF then ELSE structure like this?  Bottom

  • Hi,

    I have a problem, my knowledge’s about PHP is limited.

    I use the 2.1 version of the Updownload module on PN .750 gold (http://www.petzi-juist.de/)

    The module shows screenshots next to the downloads on the right site. I managed to move the screenshot to the left side with success. The only problem is if there is no images available it show noting. I traced down the piece of code responsible for this. Look at the following code:

    File name: dl-util.php

    //
    //shows the screenshot
    //thanks to: Luis Carlos Bethancourt
    //
    function get_screenshot($lid)
    {
    include("modules/UpDownload/includes/config.php");

    echo "
    <center>";
    if($screenshotlink =="")
    {
    $screenshotlink = "modules/UpDownload/shots";
    }

    while($ext = current($screenshot_extensions))
    {
    if(file_exists($screenshotlink."/thumbs/$lid".$ext))
    {
    $fp = @fopen($screenshotlink."/thumbs/$lid".$ext,"r");
    $small_ext = $ext;
    }

    if(file_exists($screenshotlink."/$lid".$ext))
    {
    $fp = @fopen($screenshotlink."/thumbs/$lid".$ext,"r");
    $large_ext = $ext;
    }
    next($screenshot_extensions);
    }

    if ($fp)
    {
    if(file_exists($screenshotlink."/$lid".$large_ext))
    {
    // echo "\""._FULLSCREENSHOT."\"\""._FULLSCREENSHOT."\"/ echo "\""._SCREENSHOT."\"\""._SCREENSHOT."\"";

    /* else
    {
    echo _NOPICTURE."
    "._AVAILABLE ;
    */ }

    echo"</center>
    ";
    }


    As you can see there is a second ELSE structure!!
    When I un command the following lines I get a parser error

    else
    {
    echo _NOPICTURE."
    "._AVAILABLE ;
    }

    What’s wrong? How can I nest a IF then ELSE structure like this?

    I hope somebody can shine some light on this, so I and others can learn from this.

    Any help is appreciated,

    Michiel
  • I think you need a '}' in front of the 'else' in error. As it stands you have an 'else' block that doesn't refer to any 'if'.
  • Works like a charm Curt,
    Thanks for you advice.

This list is based on users active over the last 60 minutes.