동적 요소를 위해 HTML에서 PHP로 몇 개의 사이트를 변환 중이며 (include()를 사용하여) 머리말과 꼬리말로 그렇게 할 수 있습니다. 그러나, 나는 머리 부분을하는 방법에 혼란스러워.PHP로 헤드 섹션 작성하기
<head>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js">
</script>
<![endif]-->
<meta charset="UTF-8" />
<meta name="description" content="Liberty Resource Directory. The ultimate curated directory to find what you need."/>
<meta name="keywords" content="ethan glover, lrd, liberty resource directory"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="stylesheets/lrdstylesheet.css" rel="stylesheet" media="screen">
<title>Liberty Resource Directory</title>
</head>
내가 쉽게 HTML5Shim 스크립트, 메타 캐릭터 세트, 뷰포트 (그래 난 그 최대 스케일을 제거), 그리고 스타일 시트 링크를 추가 할 수 있습니다 : 이것은 내가 일반 HTML과 함께하는 것입니다.
어떻게 내가 그에게 개별 페이지 설명, 키워드와 제목을 전달할 수있는 방법으로 .PHP 파일을 작성할 수 있습니다 : 여기
문제인가? (그런 식으로 위의 코드를 PHP 파일에 넣고 모든 페이지에 포함시킬 수 있습니다.)
또는 설명, 키워드 및 제목을 제외하고 매번 이러한 부분을 다시 작성하기 만하면됩니까? (알레한드로 아르 비사 씨)
head.php
<head>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js">
</script>
<![endif]-->
<meta charset="UTF-8" />
<meta name="description" content="<?php echo $description;?>"/>
<meta name="keywords" content="<?php echo $keywords;?>"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="../stylesheets/lrdstylesheet.css" rel="stylesheet" media="screen">
<title><?php echo $title;?></title>
</head>
index.html을 (위에 포함하는 코드)
<?php
$description="Liberty Resource Directory. The ultimate curated directory to find what you need.";
$keywords="ethan glover, lrd, liberty resource directory";
$title="Liberty Resource Directory";
include 'scripts/head.php';
?>
최종 결과 : 여기
해답이다 :
http://libertyresourcedirectory.com/
내부에 '
php include'file.php '포함을 사용할 수 있습니다. ?>'- 개별 페이지 설명 등은 좀 더 코딩이 필요합니다. * 나는 두려워합니다 *. 대신 프레임 워크를 사용하십시오. 쉬울거야. –PHP 코드를 게시하십시오. 어떤 프레임 워크 나 베어 본 PHP를 사용하고 있습니까? –