Jump to content

Recommended Posts

Hello,

 

I have created layout in php with the help of from some sites becoz i m new in php. I created it for my project of some kind of customer support.

 

so please find attachment & see that, is this a good layout or if you have any solution to make it better or more flexible so tell me.

 

So please  check that..

 

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/250680-is-this-a-good-php-layout/
Share on other sites

Here is my code & screenshots..

 

Clipboard01.jpg

 

 

Clipboard02.jpg

 

 

Here is the Code of my header.php

 

<!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>

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

<title>My Layout</title>

<link rel="stylesheet" type="text/css" href="css/style.css" media="screen" /> 

</head>

<body>

	<div id="wrapper">
<?php include('variables/variables.php'); ?>
<div id="header">

    <h2><?php echo $heading ?></h2>

</div> <!-- end #header -->

 

 

this is variable.php

 

<?php

$heading='My PROJECT';

$footer='Copyright © 2011';

?>

 

 

this is nav.php

 

<div id="nav">

<a href="index.php">Home</a>
<a href="about.php">About</a>
<a href="#">Portfolio</a>
<a href="#">Contact</a>

</div> <!-- end #nav -->

 

this is sidebar.php

 

<div id="sidebar">

<h3>Navigation</h3>
<li><a href="index.php">Home</a></li>
<li><a href="about.php">About Us</a></li>
<li><a href="#">Links</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Contact</a></li>

<h3>Box Two</h3>
<li><a href="#">Link Here</a></li>
<li><a href="#">Link Here</a></li>
<li><a href="#">Link Here</a></li>
<li><a href="#">Link Here</a></li>
<li><a href="#">Link Here</a></li>

<h3>Box Three</h3>
<li><a href="#">Link Here</a></li>
<li><a href="#">Link Here</a></li>
<li><a href="#">Link Here</a></li>
<li><a href="#">Link Here</a></li>
<li><a href="#">Link Here</a></li>

</div> <!-- end #sidebar -->

 

this is footer.php

 

<?php include('variables/variables.php'); ?>
<div id="footer">
<p><?php echo $footer ?></p>
</div> <!-- end #footer -->
        </div> <!-- End #wrapper -->

    </body>

</html>

 

this is index.php

 

<?php include('includes/header.php'); ?>

<?php include('includes/nav.php'); ?>

<div id="content">

<h1>Heading1</h1>
<h2>Heading2</h2>
<h3>Heading3</h3>
<h4>Heading4</h4>
<h5>Heading5</h5>
<h3>Paragraph Element</h3>

<p>

Quisque pellentesque sodales aliquam. Morbi mollis neque eget arcu egestas non ultrices neque volutpat. Nam at nunc lectus, id vulputate purus. In et turpis ac mauris viverra iaculis. Cras sed elit a purus ultrices iaculis eget sit amet dolor. Praesent ac libero dolor, id viverra libero. Mauris aliquam nibh vitae eros sodales fermentum. Fusce cursus est varius ante vehicula eget ultrices felis eleifend. Nunc pharetra rutrum nibh et lobortis. Morbi vitae venenatis velit.

</p>

<p>

Quisque pellentesque sodales aliquam. Morbi mollis neque eget arcu egestas non ultrices neque volutpat. Nam at nunc lectus, id vulputate purus. In et turpis ac mauris viverra iaculis. Cras sed elit a purus ultrices iaculis eget sit amet dolor. Praesent ac libero dolor, id viverra libero. Mauris aliquam nibh vitae eros sodales fermentum. Fusce cursus est varius ante vehicula eget ultrices felis eleifend. Nunc pharetra rutrum nibh et lobortis. Morbi vitae venenatis velit.

</p>

<h3>Another Heading Starting Point</h3>

<p>

Quisque pellentesque sodales aliquam. Morbi mollis neque eget arcu egestas non ultrices neque volutpat. Nam at nunc lectus, id vulputate purus. In et turpis ac mauris viverra iaculis. Cras sed elit a purus ultrices iaculis eget sit amet dolor. Praesent ac libero dolor, id viverra libero. Mauris aliquam nibh vitae eros sodales fermentum. Fusce cursus est varius ante vehicula eget ultrices felis eleifend. Nunc pharetra rutrum nibh et lobortis. Morbi vitae venenatis velit.

</p>

<p>

Quisque pellentesque sodales aliquam. Morbi mollis neque eget arcu egestas non ultrices neque volutpat. Nam at nunc lectus, id vulputate purus. In et turpis ac mauris viverra iaculis. Cras sed elit a purus ultrices iaculis eget sit amet dolor. Praesent ac libero dolor, id viverra libero. Mauris aliquam nibh vitae eros sodales fermentum. Fusce cursus est varius ante vehicula eget ultrices felis eleifend. Nunc pharetra rutrum nibh et lobortis. Morbi vitae venenatis velit.

</p>

</div> <!-- end #content -->

<?php include('includes/sidebar.php'); ?>

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

There's not a lot to say really. It's roughly a common set-up for small websites that don't stretch much beyond centralising the header/footer content. You could pass in a dynamic <title> and various tweaks like that, but that's about as far as it will take you. That's not a bad thing though, if that's all you need it for.

Its not working good when i use javascript its give errors & sometime page open with two times

 

I am using this in my nav.php

 

<ul class="menu" id="menu">
    <li><a href="#" class="menulink">Eng. Detail</a>
        <ul>
            <li><a href="#">Add Eng.</a></li>
            <li><a href="#">Modify Eng.</a></li>
        </ul>
        </li>
        
        <li><a href="#" class="menulink">Cust. Detail</a>
        <ul>
            <li><a href="#">Add Eng.</a></li>
            <li><a href="#">Modify Eng.</a></li>
        </ul>
        </li>
        
        <li><a href="#" class="menulink">Report</a></li>
        
        <li><a href="#" class="menulink">Admin Task</a>
        <ul>
            <li><a href="#">Add New Login</a></li>
            <li><a href="#">Change Password</a></li>
        </ul>
        </li>
        
        <li><a href="logout.php" class="menulink">Logout</a></li>
</ul>
<!-- end #nav -->
    <script type="text/javascript">
    var menu=new menu.dd("menu");
    menu.init("menu","menuhover");
    </script>

 

and this is my header.php

 

<!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>

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

<title>Advanced Computing Labs</title>

<link rel="stylesheet" type="text/css" href="css/style.css" media="screen" />
<script type="text/javascript" src="../js/script.js"></script> 
</head>

<body>

	<div id="wrapper">
<div id="header">

    <h1>Advanced Computing Labs</h1>

</div> <!-- end #header -->

 

find the attachment of script.txt & changeit to the script.js

 

 

 

[attachment deleted by admin]

There is no definitive 'PHP layout'. It's up to you to plan your application and design it accordingly.

 

If you want more hand holding, you might consider using a framework, be aware though that they are not something I would generally recommend new comers to jump straight into.

Hey guys now i am having another problem in this layout i am using simple login form on index.php page

 

this page calls chklogin.php page which is having this code

<?php
session_start();
include('connect.php');

$tbl_name="members"; 

mysql_select_db($Db, $link); 


// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];

// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$mypassword = md5($mypassword);

$sql="SELECT * FROM $tbl_name WHERE uname='$myusername' and upass='$mypassword'";
$result=mysql_query($sql,$link);
$row=mysql_fetch_array($result);
                                
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("username"); //Create the session
session_register("myusername");
session_register("mypassword");
$_SESSION['uname'] = "$myusername";
$_SESSION['utype'] = $row['utype'];

header("location:loginsuccess.php");
}
else {
//include ('index.php');
echo ("<script type='text/javascript'> window.alert('Wrong username or password!')</script>");
exit();
}

?>

 

after this it calls loginsuccess.php which code is

 

<?
session_start(); 
if(!session_is_registered(myusername)){
header("location:index.php");
exit();
}
require_once("login-index.php");           
?>

 

now if all login detail is true then it calls  login-index.php page but when it open the login-index.php page it also open the

index.php also in one page whereas it should have to open only login-index.php only

 

why its happening plz help me......

yes that is login-index.php

 

<?php require_once('includes/header.php'); ?>

<?php require_once('includes/nav.php'); ?>

<div id="content">

<p align="right" class="wel">Welcome <?php
         echo $_SESSION['uname'];        
         ?></p>

</div> <!-- end #content --> 

<?php require_once('includes/footer.php'); ?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.