Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP is outputting table all on one line
    text
    copied!<p>The script is supposed to take all of the pictures in a folder and output the first six of them into a table. Then I would like to add a little next button so one can view the rest of the images, but currently the script is just spitting them all out on one line. All of them, not just the six I want. In addition to that the code is also appearing at the bottom of the webpage, below a lot of code that comes after it in the document.</p> <p>The PHP</p> <pre><code>&lt;?php $i = 0; $directory = 'images/gallery/'; $files1 = scandir($directory); $x = 0; $y = 0; $z = 0; echo"&lt;table&gt;&lt;tr&gt;"; foreach ($files1 as $filename) { if ($z == $x + 6) { break 2; } if ($x==1 || $x==0) { $x=$x+1; } else { if ($y == $x + 3) { echo "&lt;td&gt;&lt;a data-lightbox='gallery' href='images/gallery/$filename'&gt;&lt;img src='images/gallery/$filename'&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;"; $y = $x; $x=$x+1; } else { echo "&lt;td&gt;&lt;a data-lightbox='gallery' href='images/gallery/$filename'&gt;&lt;img src='images/gallery/$filename'&gt;&lt;/a&gt;&lt;/td&gt;"; $x = $x+1; } } } ?&gt; </code></pre> <p>The HTML</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=iso-8859-1" &gt; &lt;title&gt;Perspective by Daniel Streich&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="scripts/css.css"&gt; &lt;link href="css/lightbox.css" rel="stylesheet"&gt; &lt;script src="js/jquery-1.10.2.min.js"&gt;&lt;/script&gt; &lt;script src="js/lightbox-2.6.min.js"&gt;&lt;/script&gt; &lt;link href="css/lightbox.css" rel="stylesheet" &gt; &lt;/head&gt; &lt;body&gt; &lt;?php $active = "Art"; include ('menu.php'); ?&gt; &lt;div class="wrapperRegular"&gt; &lt;p class="bigTitle"&gt; Perspective by Daniel &lt;/p&gt; &lt;p class='actualText'&gt; TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST &lt;/p&gt; &lt;?php include ('gallery.php'); ?&gt; &lt;br&gt; &lt;div id="footer"&gt; Copyright &amp;#169; Perspective by Daniel &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p></p> <p>The CSS</p> <pre><code>#wrapperRegular { margin: auto; width: 50%; } p.bigTitle { font-family: 'alluraregular'; font-size: 500%; text-align: center; color: 898888; line-height: .33em; } p.actualText { font-family: 'alluraregular'; color: 898888; font-size: 1.5em; } table { font-family: 'alluraregular'; color: 898888; font-size: 1.5em; margin: auto; text-align: center; border:5px; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload