1

我有一个文件,我想在这个文件中放入另外两个动态的文件。主文件是这样的:

<!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 打开包含文件,这样我就可以随时拥有这两个文件。当然,如果有其他解决方案我接受它:)

先感谢您!

4

1 回答 1

3

Pass the category ID in the request (either GET or POST using the code below):

if(isset($_REQUEST['category_id']) &&  $_REQUEST['category_id'] == '8') {          
  include('function_art_result_readmore.php'); 
} else {  
  include('function_art_result_readmore_photos.php'); 
}

`

于 2013-09-12T13:20:22.757 回答