Note that there are some explanatory texts on larger screens.

plurals
  1. POPage stops rendering after PHP include() function
    primarykey
    data
    text
    <p>Basically I'm having a go at using PHP to create a basic CMS for my website. I'm trying to write a script which creates a SPRY navigation bar from a CSV file, but the server stops rendering when it reaches the include() function which calls the script. I've checked the Apache error logs and there's nothing in there, also at the beginning of the script I echo'd a HTML comment, but that doesn't appear in the page source, so it would seem it doesn't even start to run? Any ideas as to what it could be?</p> <p>Template Header File (Included with PHP in main page file, works fine):</p> <pre><code>&lt;div id="header"&gt; &lt;div style="float:left; height:inherit;"&gt;&lt;a href="/"&gt; &lt;img src="/uploads/logo.png height="150px" alt="Bradfield &amp;amp; Bentley" /&gt; &lt;/a&gt; &lt;/div&gt; &lt;div style="float: right;"&gt;&lt;/div&gt; &lt;div id="navigation" style="clear:both;"&gt; &lt;p&gt;&lt;/p&gt; &lt;ul id="MenuBar1" class="MenuBarHorizontal"&gt; &lt;?php include($_SERVER['DOCUMENT_ROOT'].'/templatefiles/navigation.php'); ?&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="contain"&gt; &lt;div id="spacer"&gt; &lt;p&gt;&lt;/p&gt; &lt;/div&gt; </code></pre> <p>The 'navigation.php' file (The one that the server stops rendering when included):</p> <pre><code>&lt;?php echo "&lt;!-- File Opened --&gt;"; $row = 1; if (($handle = fopen($_SERVER['DOCUMENT_ROOT'].'/templatefiles/navigation.csv', "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); $row++; echo "&lt;li&gt;&lt;a href=\"".$data[$2]."\"&gt;".$data[$1]."&lt;a/&gt;&lt;li&gt;&lt;BR/&gt;"; } fclose($handle); } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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