我自称不擅长 php,所以那些专家请不要因为我的菜鸟方法而抨击我。我在尝试学习。
前段时间,有人向我展示了如何分解网页的某些部分并将它们写为包含,这样我就不必为每个页面重新绘制页眉、页脚和导航。截至昨天早上,我的页面加载正常,并且已经好多年了。但是,似乎出现了问题,可能在我的服务器上,现在所有页面都转到主页。
我的页面设置如下:
索引.php
<?php
if (! isset($HTTP_GET_VARS['content']) || ! $HTTP_GET_VARS['content']){
$content="squeeze";
}
else
$content=$HTTP_GET_VARS['content'];
//1
if ($content == "do-you-have-success-habits"){
$page_title="Do You Have Success Habits?";
$keywords="Booking Agent Book, Music Business Career Development Information, Performing Arts Entertainment Information";
$desc="Music Business Booking Management artist career development for musicians, performing artists, agents and managers";
$style="../scripts/style.css";
$popupjs="none";
$storbutnjs="none";
$retreatjs="none";
$rolloverjs="none";
$readform_chkjs="none";
$logo="req-files/logo.html";
$navbar="req-files/navbar.html";
$sidebar="req-files/sidebar.html";
$main="weekly/2013/do-you-have-success-habits.html";
}
include ("req-files/head.html");
include ($logo);
include ($navbar);
include ($sidebar);
include ($main);
include ("req-files/footer.html");
?>
这是我所拥有的精简版。整个 index.php 的所有页面都是这样编写的,但它也包含对其他 php 页面的包含。这个站点的内容太多了,以至于我不得不在一个页面中构建具有类似信息的 php 页面...... IE 所有的附属公司都会进入affiliates.php,然后像这样包含到我的 index.php 中。
// INCLUDE AFFILIATES HERE
include ("affiliates.php");
我希望这是足够的信息来帮助我解决我的问题。
我的作品样本就像这个头文件。我的变量在碎片中。
头.html
<!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>
<title><?php print $page_title ?></title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="author" content=" " />
<meta name="keywords" content="<?php print $keywords ?>" />
<meta name="description" content="<?php print $desc ?>" />
<meta name="copyright" content="2006-2013" />
<link rel="stylesheet" type="text/css" href="<?php print $style ?>" />
<link href="scripts/twoColLiqLtHdr.css" rel="stylesheet" type="text/css" /><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColLiqLtHdr #sidebar1 { padding-top: 30px; }
.twoColLiqLtHdr #mainContent { zoom: 1; padding-top: 15px; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
<link rel="stylesheet" type="text/css" href="scripts/style.css" />
<script src="scripts/stuHover.js" type="text/javascript"></script>
<link href="scripts/dropdown_menu.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.png" />
<?php
if ($popupjs != "none") {
print("<script src=\"${popupjs}\">");
print("</script>\n");
}
if ($storbutnjs != "none") {
print(" <script src=\"${storbutnjs}\">");
print("</script>\n");
}
if ($retreatjs != "none") {
print(" <script src=\"${retreatjs}\">");
print("</script>\n");
}
if ($rolloverjs != "none") {
print(" <script src=\"${rolloverjs}\">");
print("</script>\n");
}
if ($readform_chkjs != "none") {
print(" <script src=\"${readform_chkjs}\">");
print("</script>\n");
}
?>
</head>
如前所述,我对php没有经验。所以,我很难理解为什么我在导航中链接的页面会进入主页(挤压)页面。
现在,我的托管技术支持人员指出,可能是已弃用的代码导致此操作失败。他们正在迁移我的网站,可能是迁移到以前版本的 php。但我需要知道从哪里开始解决这个问题。我希望这是一个简单的修复,因为这个网站很大!
感谢您的耐心和帮助。
海蒂