What's new

Web PHP website help needed

  • Thread starter Zoid in Code
  • Start date
  • Views 621
Z

Zoid in Code

Enthusiast
Messages
447
Reaction score
49
Points
85
Sin$
0
Hey so I am making a brand new site for my clan in php but i cant get anything to be shown on the index.php :frown:

PHP:
<?php include("header.php");
    <div id="content">
        <div id="main">
            <h2><?php echo $the_title; ?></h2>
            <?php echo $the_content; ?>
        </div>
         <?php include ("sidebar.php"); ?>
    </div>
<?php include("footer.php"); ?>
<?php

Header.php:

PHP:
<?php include("functions.php"); ?>
<!DOCTYPE html>
<html>
    <head>
    <title><?php echo do_html_title($the_title) ?></title>
  
    <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <div id="wrap">
            <div id-"header">
             <h1>Demo Theme</h1>
             <p>Just a test to see if this works</p>
       </div>
        <div id="navigation">
         <?php echo do_main_nav();?>
          </div>

Footer.php:

Code:
<div id="footer">
    <div class="footer_half">
     <p>&copy;Jack Sewell 2015</p>
    </div>
    <div class="footer_half t_align_right">
     <p>Powered by <a href="https://www.google.com">Google</a></p>
    </div>
</div>
</body>
</html>
 
Im4eversmart

Im4eversmart

The hacks are real
Glitcher Modder Programmer
Messages
2,156
Reaction score
1,903
Points
455
Sin$
7
Your inline php statements are wrong in your index.php
Include syntax is wrong. Proper way to use include is, include 'file_name.php'
Missing a closing div in header.php

Just a tip to make it less confusing, your header and footer should be valid sub sections of html code. AKA, don't start the html element in one file, then end it in another.
 
P

pwfdc

Member
Bright Idea Programmer Experienced Veteran
Messages
1,540
Reaction score
677
Points
465
Sin$
0
Your inline php statements are wrong in your index.php
Include syntax is wrong. Proper way to use include is, include 'file_name.php'
Missing a closing div in header.php

Just a tip to make it less confusing, your header and footer should be valid sub sections of html code. AKA, don't start the html element in one file, then end it in another.
Unless you're using blade. Really if you're doing any sort of widget type development like this it's actually a good idea, if done right.
Because having header.html and footer.html will give you a base and then for each page it can be like index.php (header.html + home.html + footer.html), team.php (header.html + team.html + footer.html).
The other advantage to this is if you release your site and then realize something went wrong in your footer, you don't have to go to EVERY file, just one.
And really my header code would look like
Code:
<html>
<head></head>
<body>
<content>
and footer would be like...
Code:
</content>
<footer></footer>
</body>
</html>

This would be how I would do it if I were doing it personally.
 
Im4eversmart

Im4eversmart

The hacks are real
Glitcher Modder Programmer
Messages
2,156
Reaction score
1,903
Points
455
Sin$
7
Unless you're using blade. Really if you're doing any sort of widget type development like this it's actually a good idea, if done right.
Because having header.html and footer.html will give you a base and then for each page it can be like index.php (header.html + home.html + footer.html), team.php (header.html + team.html + footer.html).
The other advantage to this is if you release your site and then realize something went wrong in your footer, you don't have to go to EVERY file, just one.
And really my header code would look like
Code:
<html>
<head></head>
<body>
<content>
and footer would be like...
Code:
</content>
<footer></footer>
</body>
</html>

This would be how I would do it if I were doing it personally.

It's good to have header and footer files. It's bad practice to mix an element between files.

The header/footer elements are containers, so they should be static, and the dynamically loaded content is inserted inside those elements.
 
Sumo

Sumo

ヽ༼ຈل͜ຈ༽ノ raise your dongers ヽ༼ຈل͜ຈ༽ノ
VIP
Retired
Nevar gon' happen in your lifetime Odysseus' Summit 5th Anniversary
Messages
5,496
Reaction score
3,452
Points
1,085
Sin$
0
Your inline php statements are wrong in your index.php
Include syntax is wrong. Proper way to use include is, include 'file_name.php'
Missing a closing div in header.php

The brackets is perfectly valid syntax.
 

Similar threads

Replies
2
Views
349
Green_Man
Green_Man
Replies
5
Views
444
Zoid in Code
Z
Replies
0
Views
307
Zoid in Code
Z
Top Bottom
Login
Register