Jump to content

[SOLVED] Includes not displaying properly


wrathican

Recommended Posts

hey guys.

 

i decided to make a basic 'template' and include my header and footer around my content. the footer is not displaying how i imagine it should.

 

the whole page should look like this:

http://www.ls12style.co.uk/projects/random

 

but the page does not display the right hand column.

as can be seen here:

http:www.test.ls12style.co.uk/test.php

 

i duplicated my index page from the '/projects/random/' which has some php retrieving some data from a DB. This page does not show at all. as can be seen here:

http://www.test.ls12style.co.uk/index.php

 

this is the header:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="/random.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>LS12 Community :: <?php echo $page_title ?></title>
</head>
<body>
<div id="wrapper">
  <div id="header"><img src="/images/logo.png" alt="Random Website" /></div>
  <div id="content-wrapper">
    <div id="content">
      <div class="in">
        <h2><?php echo $page_title ?></h2>

 

This is my footer:

      </div>
    </div>
  </div>
  <div id="left">
    <div class="in">
      <h2>Navigation</h2>
      <ul class="navi">
        <li>&#187; <a href="/index.php">Home</a></li>
        <li>&#187; <a href="/about.php">About Us</a></li>
        <li>&#187; <a href="/gallery.php">Gallery</a></li>
        <li>&#187; <a href="/contact.php">Contact Us</a></li>
        <li>&#187; <a href="/blogs.php">Blogs</a></li>
      </ul>
      <br />
      <?php
  if ($_SESSION['loggedin'] == "yes") {
  	//display members nav
	?>
      <h4>Members Section</h4>
      <p>Welcome, <?php echo $_SESSION['username']; ?>!</p>
      <ul class="navi">
        <li>&#187; <a href="/members/galleryadmin.php">Gallery Admin</a></li>
        <li>&#187; <a href="/members/forum.php">Forum</a></li>
        <li>&#187; <a href="/members/details.php">Change Details</a></li>
        <li>&#187; <a href="/members/password.php">Change Password</a></li>
        <li>&#187; <a href="/members/announce.php">Announcements</a></li>
        <li>&#187; <a href="/members/blogadmin.php">Blogging</a></li>
        <li>&#187; <a href="/functions/userfunctions.php?func=logout">Log Out</a></li>
        <?php
	  	if ($_SESSION['level'] == 1) {
			?>
        <li>&#187; <a href="/admin/index.php">Admin</a></li>
        <?php
		}
	  ?>
      </ul>
      <?php
  }else{
  	//display login form
	?>
      <form action="/functions/userfunctions.php?func=login" method="post" id="login">
        Username:<br />
        <input type="text" name="username" />
        <br />
        Password:<br />
        <input type="password" name="password" />
        <br />
        <input type="submit" name="login" value="Login" />
        &#187; <a href="/register.php">Register</a>
      </form>
      <?php
  }
  ?>
    </div>
  </div>
  <div id="right">
    <?php
  //get recent/site statistics
  
  //members
  $mQuery = "SELECT * FROM ls12_users";
  $mResult = query($mQuery);
  $mNumRows = numRows($mResult);
  
  //recent topics
  $tQuery = "SELECT topic_id, topic_title FROM ls12_topic ORDER BY topic_lastpost DESC LIMIT 2";
  $tResult = query($tQuery);
  
  //forum posts
  $pQuery = "SELECT * FROM ls12_post ORDER BY post_id DESC";
  $pResult = query($pQuery);
  $pNumRows = numRows($pResult);
  
  //galleries
  $gQuery = "SELECT * FROM ls12_album ORDER BY album_id DESC LIMIT 2";
  $gResult = query($gQuery);
  $gNumRows = numRows($gResult);
  
  //pictures
  $iQuery = "SELECT * FROM ls12_image ORDER BY image_id DESC";
  $iResult = query($iQuery);
  $iNumRows = numRows($iResult);
  
  //blogs 
  $bQuery = "SELECT * FROM ls12_blog ORDER BY blog_id DESC";
  $bResult = query($bQuery);
  $bNumRows = numRows($bResult);
  
  ?>
    <div class="in">
      <h2>Recent Updates</h2>
      <h4>Galleries</h4>
      <?php
  
  while ($gRow = mysql_fetch_array($gResult)) {

    $alId = $gRow['album_id'];
  	$alName = $gRow['album_name'];
	$alImg = $gRow['album_image'];
	$alUid = $gRow['album_ownerid'];

	?>
      <p>&#187; <a href="/gallery.php?func=viewal&alid=<?php echo $alId; ?>"><?php echo $alName; ?><br />
        <img src="/images/album/<?php echo $alImg; ?>"></a><br />
        <?php
	$oName = getUsername($alUid);
	echo 'By '.$oName.'</p>';
  }
  
  ?>
      <h4>Forum Posts</h4>
      <ul>
        <?php 
while ($tRow = mysql_fetch_array($tResult)) {
	$topicId = $tRow['topic_id'];
	$topicTitle = $tRow['topic_title'];
	?>
        <li>&#187; <a href="/members/forum.php?func=viewtopic&topicid=<?php echo $topicId; ?>"><?php echo $topicTitle; ?></a></li>
        <?php
}
?>
      </ul>
      <h4>Blogs</h4>
      <?php
  //list last 5 blogs
  if ($bNumRows != 0) {
  	echo "<ul>";
  	while ($bRow = mysql_fetch_array($bResult)) {
  		$blogId = $bRow['blog_id'];
		$blogTitle = $bRow['blog_title'];
		$blogAuth = $bRow['blog_authorid'];

		//get username
		$bUserName = getUsername($blogAuth);

		?>
      <li>&#187; <a href="/blogs.php?blogid=<?php echo $blogId; ?>"><?php echo $blogTitle; ?></a>
        <ul>
          <li class="nested">by <?php echo $bUserName; ?></li>
        </ul>
      </li>
      <?php
	}
	echo "</ul>";
  }else{
  	echo "No blogs yet";
  }
  
  ?>
      <h4>Statistics</h4>
      <p>Members: <?php echo $mNumRows; ?><br />
        Albums: <?php echo $gNumRows; ?><br />
        Pictures: <?php echo $iNumRows; ?><br />
        Forum Posts: <?php echo $pNumRows; ?><br />
        Blogs: <?php echo $bNumRows; ?></p>
    </div>
  </div>
  <div id="footer">Copyright © 2008 <a href="http://members.ls12style.co.uk">Members.LS12Style.co.uk</a> Web design by <a href="http://www.ls12style.co.uk">Ashley Broadley</a></div>
</div>
</body>
</html>
<?php

include "/includes/close.php";

?>

 

and this is my final page(that doesnt display anything):

<?php
//Included files
include "/includes/misc.php";
include "/includes/opendb.php";
include "/includes/functions.php";

//start session
session_start();

//breadcrumb
$page_title = "Welcome";

include "/includes/header.php";

?>
<p>Welcome to the brand new LS12Style.<br />
          This is still THE place for us guys to share our pictures, videos and messages. Feel free to explore, take a peek at some of the pictures from various parties/festivals/random places.<br />
          <br />
          Fancy making your own picture album? Well, click <a href="register.php">here </a>to register!<br />
          Unsure about registering? Want to find out why you should register? Well then, click <a href="benefits.php">here</a> to find out more!</p>
        <?php
$query = "SELECT * FROM ls12_announce ORDER BY ann_date DESC LIMIT 5";
$result = mysql_query($query);
$numRows = mysql_num_rows($result);
if ($numRows != 0) {
echo '<h2>Announcements</h2>';
while ($row = mysql_fetch_array($result)) {
	$annId = $row['ann_id'];
	$title = $row['ann_title'];
	$message = $row['ann_message'];
	$userId = $row['ann_ownerid'];
	$odate = $row['ann_date'];
	$tdate = strtotime($odate);
	$date = date("F j, Y, g:i a", $tdate);

	$queryName = "SELECT user_username FROM ls12_users WHERE user_id = '".$userId."'";
	$resultName = query($queryName);
	$arrayName = mysql_fetch_array($resultName);
	$userName = $arrayName['user_username'];
	?>
        <div class="announce">
          <h3><?php echo $title ?></h3>
          <p> <?php echo $message ?><br />
            <br />
            Posted by <?php echo $userName . " on " . $date; ?><br />
</p>
<?php
include "/includes/footer.php";
?>

 

any idea why this is happening?

 

Link to comment
https://forums.phpfreaks.com/topic/113692-solved-includes-not-displaying-properly/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.