我有一个文件要放在这个文件中,另外两个文件是动态的。主要文件是:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Gaming Ventus Let's Play - VLet's Play</title>
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="stylesheet" type="text/css" href="../styles/article_style_readmore.css">
<link rel="stylesheet" type="text/css" href="../../styles/styles_content_static_contact/styles_alltemplate_static_contact.css">
<link rel="stylesheet" type="text/css" href="../styles/readmore_mainbody_style.css">
<link rel="stylesheet" type="text/css" href="../../test/test2/Untitled-3.css">
</head>
<body>
<div id="wrapper">
<div id="header">
<div id="top_header">
<ul id="icons">
<li><a href="http://youtube.com/" target="_blank"><img src="../../images/youtube-icon.png" alt="YT" width="32" height="32" /></a></li>
<li><a href="http://facebook.com/" target="_blank"><img src="../../images/facebook-icon.png" alt="Fb" width="32" height="32" /></a></li>
<li><a href="http://twitter.com/" target="_blank"><img src="../../images/twitter-icon.png" alt="Twit" width="32" height="32" /></a></li>
<li><a href="http://google.com/" target="_blank"><img src="../../images/google-icon.png" alt="Goog" width="32" height="32" /></a></li>
<li><a href="#" target="_blank"><img src="../../images/rss-icon.png" alt="Rss" width="32" height="32" /></a></li>
</ul>
</div>
<div id="bottom_header">
<a href="../../index.php?page=home">
<div id="logo"><img src="../../images/Ventus_Gaming_logo.png"></div>
</a>
<div id="search_bar">
<form>
<input type="text" id="search">
<label for="search">Search</label>
</form>
</div>
</div>
</div>
<div id="menu">
<ul>
<li><a href="../../index.php?page=home">Home</a></li>
<li><a href="../../index.php?page=reviews">Reviews</a></li>
<li><a href="../../index.php?page=news">News</a></li>
<li><a href="../../index.php?page=videos">Videos</a></li>
<li><a href="../../index.php?page=photos">Photos</a></li>
<li><a href="../../content_static_main_body/contact.php?page=contact">Contact Us</a></li>
</ul>
</div>
<div id="main_body">
<div id="main_left_nav">
/****************************************************************\
<?php
include('function_art_result_readmore.php');
include('function_art_result_readmore_photos.php');
?>
\****************************************************************/
</div>
<div id="right_nav">
<div id="right_nav_about">
About!
</div>
<div class="right_nav_others">
Reviews!
</div>
<div class="right_nav_others">
News!
</div>
<div class="right_nav_others">
Videos!
</div>
<div class="right_nav_others">
Photos!
</div>
</div>
</div>
<div id="footer">
<p>Copyright Ventus Gaming</p>
</div>
</div>
<?php
//Ayto einai to apotelesma otan patas to read more dhladh ta post mona tous
?>
</body>
</html>
所以在星号部分我有两个我想要包含的文件......那些文件有mysql代码和php代码。所以我想把它们包括在这样的东西中:
<?php
if ($CatID == 8) {
include('function_art_result_readmore.php');
} else {
include('function_art_result_readmore_photos.php');
}
?>
但这不起作用,仅举例说明。所以我想按类别ID打开包含文件,这样我随时都可以使用这两个文件。 当然,如果有另一种解决方案我接受它:)
提前谢谢!
答案 0 :(得分:3)
在请求中传递类别ID(使用以下代码进行GET或POST):
if(isset($_REQUEST['category_id']) && $_REQUEST['category_id'] == '8') {
include('function_art_result_readmore.php');
} else {
include('function_art_result_readmore_photos.php');
}
`