私はいくつかのphpファイルを作成しました.以下はそれらの名前です:
- standard_head.php (基本的な標準 HTML コードを含む)
- header.php
- navbar.php
- サイドバー.php
- フッター.php
- standard_footer.php (終了 html タグを含む)
ページのコンテンツはページごとに異なり、html コンテンツも含まれます。
上記のすべてのページを直接使用する多くの php ページを作成しようとしています。
今では、それぞれに include ステートメントを使用して直接使用できますが、1 つの just ステートメントでそれらすべてを一緒に含めることができるかどうか疑問に思っていました。
<?php include('../includes/standard_head.php'); ?>
<?php include('includes/header.php'); ?>
<div id="wrapper">
<?php include('includes/nav.php'); ?>
<div id="content">
<!-- my page content -->
</div> <!-- end #content -->
<?php include('includes/sidebar.php'); ?>
</div> <!-- End #wrapper -->
<?php include('includes/footer.php'); ?>
<?php include('../includes/standard_footer.php'); ?>