在动态php页面上有静态设计模板

时间:2017-10-03 10:00:43

标签: php html css

我正在尝试用PHP创建一个Web应用程序,并且我已经设计了我的初始50%,其中包含一个带有其他页眉和页脚设计的登录页面。

我希望在整个页面中保持页眉和页脚设计,只是想根据用户重定向更改包含的bin文件。

请参阅下面的摘要。 附:它不是完整的代码,而且正在进行中。

<Target Name="RemoveNetFxForceConflicts" AfterTargets="ResolveAssemblyReferences">
  <ItemGroup>
    <ReferencePath Remove="@(ReferencePath)" Condition="'%(FileName)' == 'netfx.force.conflicts'" />
  </ItemGroup>
</Target>

我的index.php填充在.php作为起始页。

session_start();
ob_start();

header('Content-Type: text/html; charset=utf-8');
header('Cache-Control: private');

require_once ('lib/php/connection.php');
require_once ('lib/php/global.php');
require_once ('lib/php/session.php');
require_once ('lib/php/function.php');

$aController = array_values( array_diff( explode('/', $_SERVER['REQUEST_URI']), explode('/', $_SERVER['SCRIPT_NAME'])));

if (isset($aController[0])) {

    switch (strtolower($aController[0])) {

        /*case 'login';
            $setPage = 'dir_login/index.php';
            $setTitle = 'Login';
            break;*/
        case 'forgot-password';
            $setPage = 'dir_content/forgotPassword.php';
            $setTitle = 'Forgot your password';
            break;
        default:
            $setPage = 'dir_content/error.php';
            $setTitle = '404 Error';
            break;
    }
} else {
        //for all the default cases
        $setPage = 'dir_login/index.php';
        $setTitle = 'Login';
}

?>

<!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>
<?php
    echo '<title>';
    if (isset($setTitle)) {
        echo $setTitle;
        echo ' - ';
    }
    echo D_COMPANY_NAME;
    echo '</title>';
    if (defined ('D_PROJECT_TITLE')) {
        echo '<meta name="project-title" lang="en" content="'.htmlspecialchars(D_PROJECT_TITLE, ENT_QUOTES).'" />';
    }
    if (defined ('D_PROJECT_DESCRIPTION')) {
        echo '<meta name="project-description" lang="en" content="'.htmlspecialchars(D_PROJECT_DESCRIPTION, ENT_QUOTES).'" />';
    }
    echo '<meta name="publisher" content="'.htmlspecialchars(D_COMPANY_OWNER, ENT_QUOTES).'" />';;
    echo '<meta name="copyright" content="'.htmlspecialchars(D_COMPANY_NAME, ENT_QUOTES).'" />';

?>
    <meta name="author" content="Saurabh Gupta, IT System Developer @ Somex Automation Ltd." />
    <meta name="language" content="english" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-script-type" content="text/javascript" />
    <meta http-equiv="Content-style-type" content="text/css" />
    <meta http-equiv="Content-Language" content="en" />
    <meta http-equiv="imagetoolbar" content="no" />

    <link rel="stylesheet" type="text/css" media="screen" href="lib/css/reset.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="lib/css/custom.css"/>
    <script language="JavaScript" type="text/javascript" src="lib/js/modernizr.custom.18450.js"></script>
    <script language="JavaScript" type="text/javascript" src="lib/js/cookie.js" ></script>
    <script type="text/javascript" src="https://code.jquery.com/jquery-2.0.2.min.js" ></script>
    <script language="JavaScript" type="text/javascript" >
        <!-- Google Tag, Hotjar Tag -->
    </script>
</head>

<body>
<?php
$aBgImages = array(
        'signup_bg.png'
);
?>
<div id="header"<?php echo ((!isset($aController[0]) || (strpos($aController[0], '?') !== false)) ? ' class="front" style="background-image: url(gfx/'.getRandomImage($aBgImages).'"' : ''); ?>>
    <div id="top">
        <div id="nav">
            <?php
                echo '<div id="logo-position">';
                    echo '<a href="http://www.somexautomation.ie"> <img src="gfx/logo.png" style="margin-left: 10%; margin-top: 2%; padding-bottom: 20px;" /></a>';
                    echo '<a href="/" class="button fright"  ">&raquo; Home</a>';
                    echo '</div>';

            ?>

            <div class="clearfix"></div>
        </div>
    </div>
</div>

<div id="wrapper" <?php echo ((!isset($aController[0]) || (strpos($aController[0], '?') !== false)) ? ' class="front"' : ''); ?>>
    <?php
        include ($setPage);
    ?>
</div>
<div class="clearfix"></div>

<div id="footer">
    <div class="clearfix"></div>
    <div id="copyright">
        <span>
            <div="footer-back">
            Phone: +353 (0) 26 65770  &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;  Email: automation@somexautomation.ie<br />
            Fax: +353 (0) 26 65780    &emsp;&emsp;&emsp; &copy;<?php echo date('Y').' '. D_COMPANY_NAME; ?> - Reg No. 584538<br />
            </div>
        </span>
    </div>
</div>
</body>

</html>

初始页面工作正常,但当我切换到dir_login->index.phpindex.php等其他页面时,页面会填充代码,但不会保留设计。

无论未定义的链接是否填充了设计。

switch语句中的<?php /** * Created by PhpStorm. * User: sgupta * Date: 28/09/2017 * Time: 15:46 */ $pageName = 'dir_login/index.php'; $pageLink = '/'; if (isset($_SESSION['sEmployeeID'])) { header('Location: /'); exit(); } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $aErrorClass = ' class="text-error"'; $aError = array(); if (!isset($_POST['employeeID']) || trim($_POST['employeeID']) == '') { $aError['employeeID'] = 'Please type in your Employee ID'; } if (!isset($_POST['password']) || trim($_POST['employeeID'])) { $aError['password'] = 'Please type in your password'; } elseif (!isset($_POST['password']) || (strlen($_POST['password']) < 5)) { $aError['password'] = 'This password is wrong'; } if (count($aError) == 0) { $sQueryLogin = " SELECT employeeID, name, rate, payRate. password, level, email, type FROM tblemployees WHERE employeeID = ? AND password = ? "; if ($stmtLogin = $mysqli->prepare($sQueryLogin)) { $sEmployeeID = $_POST['employeeID']; $sPassword = $_POST['password']; $stmtLogin->bind_param('ss', $sEmployeeID, $sPassword); if ($stmtLogin->execute() === false) { trigger_error('stmtLogin execution failed '.$stmtLogin->error, E_USER_ERROR); } $stmtLogin->store_result(); $numLogin = $stmtLogin->num_rows; $stmtLogin->bind_result($employeeID, $name, $rate, $payRate, $password, $level, $email, $type); $stmtLogin->fetch(); if ($numLogin == 1) { } } } } //echo 'This Page'; ?> <h1>Log in your Somex Timesheets account</h1> <form action="<?php echo $pageLink; ?>" method="post" enctype="multipart/form-data" name="loginForm" class="shadow"> <?php echo (isset($sLoginError) ? '<h2 class="text-error">'.$sLoginError.'<h2>' : ''); ?> <ul> <li> <label for="employeeID" <?php echo (isset($aError['employeeID'])? $aErrorClass : ''); ?>>Your Employee ID</label> <input type="text" name="employeeID" id="employeeID" value="<?php (isset($_POST['employeeID']) ? htmlspecialchars($_POST['employeeID'], ENT_QUOTES) : ''); ?>" /> <?php echo (isset($aError['employeeID']) ? '<div class="info-line">'.$aError['employeeID'].'</div>' : ''); ?> </li> <li> <label for="password"<?php echo (isset($aError['password']) ? $aErrorClass : ''); ?>>Your password</label> <input type="password" name="password" id="password" /> <div class="info-line"><?php echo (isset($aError['password']) ? $aError['password'].'<br />' : ''); ?><a href="/forgot-password/">I forgot my password</a></div> </li> </ul> <div class="clearfix"></div> <input name="send" type="submit" class="button" value="&raquo; Log in"/> <div class="clearfix"></div> </form> 大小写符合我想要的但不是其他页面。

CSS:

forgetpassword.php

为我的英语道歉。

需要帮助 添加了屏幕截图:index.phpforgotpassword.php

0 个答案:

没有答案