Results 1 to 3 of 3

Thread: [RESOLVED] Loop & Code exiting after echoing iframe

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Resolved [RESOLVED] Loop & Code exiting after echoing iframe

    Here is my code:

    Code:
    <?php
    if($fileContents == "New Page"){
    echo "Please select a layout for this new page.<br />";
    if ($handle = opendir('layouts')) {
      	$count = 0;
    	while (false !== ($file = readdir($handle))) {
            if ($file != "thumbnails" && $file != "." && $file != "..") {
    		   	echo "<iframe src='layouts/$file' style='width:200px;height:200px;' />";
    			$count++;
            }
        }
    	closedir($handle);
    }
    echo "<br />Count: $count";
    }
    ?>
    The Problem
    After the first Iframe is echoed, the PHP exits, just as if I were to use exit();. If I replace echo "<iframe...." with echo $file, it displays three files - which means there should be three Iframes when using the Iframe echo statement. Why is the Iframe exiting my PHP code?

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Loop & Code exiting after echoing iframe

    it is outputting all the iframes -- you're just not closing them.
    Code:
    </iframe>
    iframes won't let you close them without an explicit closing tag.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    Re: Loop & Code exiting after echoing iframe

    Quote Originally Posted by kows View Post
    it is outputting all the iframes -- you're just not closing them.
    Code:
    </iframe>
    iframes won't let you close them without an explicit closing tag.
    Oh, I never thought there was a need for the closing tag.. I thought I could write it the same way I write <br /><hr /><img /> etc...

    Thanks, it works.

Posting Permissions

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



Click Here to Expand Forum to Full Width