2013-04-28 86 views
0

在我正在處理的網站中,我有標題&頁腳包含。我希望能夠在網站的每個頁面上使用不同的元描述,但這讓我感到困惑。標題正常工作,但我想知道這是否因爲引號不合。可變元描述

的header.php代碼:

<!DOCTYPE html> 

<head> 

<meta charset="UTF-8"> 
<title><?php echo $title; ?></title> 
<meta name="description" content="<?php echo $desc; ?>"> 
<meta name="keywords" content="neurologist, neurologic, neurology, nervous system, brain, seizure, epilepsy, carpal tunnel, seattle, ballard, washington, wa, king county, swedish hospital"> 

的index.php代碼:

<?php include ("header.php"); ?> 
<?php $title = "Neurologic Clinic | Dr. Hal Rappaport | Seattle Neurologist"; ?> 
<?php $desc = "Dr. Hal Rapport is a neurologist located in Seattle's Ballard neighborhood. He specializes in neurologic conditions and disorders and is also a certified psychologist"; ?> 

任何幫助您能給表示讚賞。

+0

包含標題**後**你分配給'$ title'和'$ desc' – Matthew 2013-04-28 22:03:15

回答

1

這是因爲你指定你的變量之後包括頭,所以改爲

<?php $title = "Neurologic Clinic | Dr. Hal Rappaport | Seattle Neurologist"; ?> 
<?php $desc = "Dr. Hal Rapport is a neurologist located in Seattle's Ballard neighborhood. He specializes in neurologic conditions and disorders and is also a certified psychologist"; ?> 
<?php include ("header.php"); ?> 
0

首先,定義$title$desc。然後包括

<?php 
    $title = "title"; 
    $desc = "description"; 

    include("header.php"); 
?> 
0

你並不需要調用<?php ?>中的每一行。

<?php 
$title = "Neurologic Clinic | Dr. Hal Rappaport | Seattle Neurologist"; 
$desc = "Dr. Hal Rapport is a neurologist located in Seattle's Ballard neighborhood. He specializes in neurologic conditions and disorders and is also a certified psychologist"; 
include ("header.php"); 
?> 
+1

感謝您的幫助! – 2013-04-28 22:15:18