0
템플릿으로 사용되는 content.php
스크립트가 있습니다. 요청에서 페이지의 이름을 가져옵니다. 각 페이지에는 제목과 메타 태그 값이 있어야합니다.헤더를 포함시킨 후 헤더에 내용을 추가하는 방법은 무엇입니까?
각 페이지에서이 값을 설정할 수있는 방법이 있습니까?
content.php
<?php
include "header.php";
include "content/{$_GET['page']}.php";
include "footer.php";
?>
header.php
<html>
<head>
<title><?php echo $title ?></title>
<meta name="title" content="<?php echo $meta['title'] ?>">
<meta name="description" content="<?php echo $meta['description'] ?>">
<!-- and other elements that goes here -->
</head>
<body>
footer.php
,536 :다음
샘플이고page1.php
<?php
$title = 'Some Title';
$meta = ['title' => 'Some Title', 'description' => 'Some Description'];
?>
My Content
그리고 불행하게도, 나는 어떤 템플릿 엔진을 사용할 수 없습니다 :
</body>
</html>
는 내가 어떤을 추가하지 않고 같은 것을 할 수 있도록하고 싶습니다
안에 포함되어 있습니다.
content/{$ _GET [ 'page']} .php ";"이걸로 펑키 한 일을 할 수 있다는 걸 알았습니까? – PeeHaa
롤 예, 그냥 간단하게 유지하고 있습니다. –
@LynnAdrianna : 'content.php? page = ../content'와 같은 간단한 것입니까? – hakre