0

I am getting very frustrated with trying to track down the source of my problems with the code below. I believe it is something to do with php files not being run. (Note that all files are in the same directory, with sudo access to each other. It is currently displaying a white screen on the following code. All other code sections that are not relevant have not been shown here) and due to me just starting to learn PHP, I am confused as to where this issue is originating. index.html:

<html>
<head>
    <link rel="stylesheet" href="styles.css" type="text/css" media="screen">
    <title> Test Server - Rasp 1</title>
</head>
<body>
<?php include('header.php');?>
<div class="body_hold">
    <div class="row">       
        <div class = "column leftm"> 
            <h2> Left </h2>
        </div>

        <div class = "column middlem" style="height: 100%;"> 
            <h2> Welcome to... </h2>
            <h1> Tegarn Empire Home</h1>
            <p> This is a test paragraph!!! <br> <br> <br></p>
        </div>

        <div class = "column rightm"> 
            <h2> Right </h2>
        </div>
    </div>
</div>

<?php include('footer.php');?>

Here's Header.php:

<!DOCTYPE html>
        <div class="header main">
            <img src="media/tgelogo.png" class="logo"> 
            <div class="header-right">
                <a class="active" href="index.php">Home</a>
                <a href="contact-us.php"> Contact Us</a>

            </div>
        </div>
        <p> End of header...</p>

And here's footer:

<!DOCTYPE html>
<div class="footer">
    <p> This Website is property of the Tegarn Empire. </p>

</div>
</body>
</html>

The css file for this is quite extensive... (I saved it as txt by accident, but on the server, its actually .css: https://pastebin.com/VfRYSWf0

I have tried everything I can think of. By the way, before I started using PHP and kept it all in one HTML script, it was working fine.

  • Welcome to SE RPi Jerry. I would be surprised if the browser likes coming across the DOCTYPE in the header and footer like that. – Mike Poole Nov 13 '19 at 16:57
  • This question should be migrated to webmaster forum – Sohan Arafat Nov 14 '19 at 22:33
1

I think the browser is getting thrown by the DOCTYPE's in the header and footer. It should not need to see them because it knows index.html is an HTML document.

I would remove <!DOCTYPE html> from both PHP include files and put the HTML5 <!DOCTYPE html> declaration at the start of your index.html instead.

|improve this answer|||||
  • It still shows me a white screen. (Both before and after I removed the tags) - what could be going on? @Mike Poole – JerryPlayz101 Nov 14 '19 at 8:57
  • I don't know what I did, but I did something and it fixed it; no idea how or why. Thanks for the suggestion - I think it may have solved one of my issues. – JerryPlayz101 Nov 14 '19 at 9:22
  • @JerryPlayz101 that is great news. Always glad to help. – Mike Poole Nov 14 '19 at 11:57
  • This doesn't answer a question to Raspberry Pi. – Ingo Nov 14 '19 at 17:47
  • The OP asked the question so I helped them by answering it. If you are objecting because you view the question as off topic surely that is something to bring up with the OP rather than with someone who wants to help them. Why is it that this stack seems to have several veterans who seem more interested in procedures than in helping new members asking and answering questions? – Mike Poole Nov 14 '19 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.