[英]HTML and PHP: How do I arrange my pages correctly?
I really have a problem with my pages... I have currently my style.css for my CSS, index.php for the home page, my "includes" folder for all my includes (navigation.php and header.php) and my register.php: http://prntscr.com/8320hv 我的页面确实有问题...目前,我的CSS有style.css,主页有index.php,所有包含项(navigation.php和header.php)都有“ includes”文件夹, register.php: http : //prntscr.com/8320hv
I just started coding my work, so there is not much. 我刚刚开始编码我的工作,所以没有太多。 I have a problem with the organization of my pages.
我的页面组织有问题。 I would like to put some content to my index.php:
我想在index.php中添加一些内容:
http://prntscr.com/832496 http://prntscr.com/832496
Code: 码:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Test 2</title>
<meta charset="UTF-8">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<link href="css/style.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
<?php require "includes/navigation.php"; ?>
<?php require "includes/header.php"; ?>
<div class="wrapper">
<div id="container">
<div id="breadcrumb-top" class="breadcrumb">
<ul>
<li>
<a href="#">Home</a>
</li>
</ul>
</div>
<span class="big-title">Home</span>
<div id="breadcrumb-bottom" class="breadcrumb">
<ul>
<li>
<a href="#">Home</a>
</li>
</ul>
</div>
</div>
</div>
</body>
</html>
But if I would like to go in my register.php file, my index.php is not linked to it: http://prntscr.com/8322hn 但是,如果我想进入register.php文件,则不会将index.php链接到该文件: http : //prntscr.com/8322hn
I am obliged to operate this way, because I would like to assign a different content for my index.php and my register.php in the container: http://prntscr.com/8323ht 我必须以这种方式进行操作,因为我想为容器中的index.php和register.php分配不同的内容: http : //prntscr.com/8323ht
I am really lost with this, so if I could have help, I you acknowledging. 我真的迷失了,所以如果我能帮上忙,我就承认。
You are doing fine so far, you just need to include the separate content for each page within each page. 到目前为止,您一切都很好,您只需要在每个页面中包括每个页面的单独内容即可。 Having a common navigation .php is a standard thing to do, though I would have navigation.php within the root folder, that way your relative links are easier to manage.
尽管我会在根文件夹中包含navigation.php,但是具有通用的Navigation .php是标准操作,因此您的相对链接更易于管理。
All 4 files in the same folder, with stylesheet.css in a css/ folder: 所有4个文件位于同一文件夹中,而css /文件夹中包含stylesheet.css:
head.php: head.php:
<head>
<link href="css/stylesheet.css" rel="stylesheet" type="text/css">
</head>
nav.php: nav.php:
<div class="nav">
<a href="index.php> home</a> |
<a href="register.php> register</a>
</div>
index.php: index.php:
<html>
<?php include "head.php"; ?>
<body>
<?php include "nav.php"; ?>
<div class="container">
<h1>This is home</h1>
</div>
</body>
</html>
register.php: register.php:
<html>
<?php include "head.php"; ?>
<body>
<?php include "nav.php"; ?>
<div class="container">
<h1>This is register</h1>
</div>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.