nezona Posted December 4, 2007 Share Posted December 4, 2007 Hiya guys I need your help again surrounding meta name and php. I have a file called header.php, which contains the following code:- <TITLE>Prime Office Environments</TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> Now my understanding is that the header.php, contains information for all pages, fine for a single page but when your doing seo, you need the meta information to be different for different pages. How can I change this:- below is the meta information for the front page <TITLE>Your Office Furniture needs at Prime Office Enviroments, chairs, desks, drawers, filing and more Office Furniture</TITLE> <meta name="description" content="is a national office furniture company that deals with new and used office furniture. We offer extensive services from buying, selling, installation, liquidations, project management, design and asset management. We carry only Grade A office furniture."> <meta name="keywords" content="Office furniture, used office furniture, office filing, office chairs, workstations, deliver throughout the US, "> <META NAME="Generator" CONTENT="EditPlus"> but I dont know what to take out in the header.php, and where to put this in terms of php in the following script:- <? $page="workstations"; include_once("../includes/header.php"); $count=0; $idcount=0; $sqlSel="SELECT * from products where category='4'"; $resSel=mysql_query($sqlSel) or die (mysql_error()); $affrows =mysql_num_rows($resSel); if ($affrows > 0) { while($rowssel=mysql_fetch_array($resSel)) { $count++; $idcount++; $pid=$rowssel['id']; $name=$rowssel['name']; $price=$rowssel['price']; $img=$rowssel['image']; $jid="p".$idcount; if ($count==1) { $content.=' <tr> <td width="155px" height="240px" background="'.IMAGE_PATH.'bgbox.jpg" valign="top" id="'.$jid.'"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="19px" width="155px" valign="bottom" class="whttxt"> '.$name.'</td> </tr> <tr> <td height="19px" width="155px" align="right" class="whttxt">$'.$price.' </td> </tr> <tr> <td height="202px" width="155px" align="center" colspan="2"><a href="desc/?pid='.$pid.'&cat=4" onmouseover="mover(\''.$jid.'\')" onmouseout="mout(\''.$jid.'\')"><img src="../includes/thumb.php?src='.$img.'&x=152&y=201&f=0" border="0"></a></td> </tr> </table> </td> '; } else if ((($count%4)==0) || $count==$affrows){ $content.=' <td width="155px" height="240px" background="'.IMAGE_PATH.'bgbox.jpg" valign="top" id="'.$jid.'"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="19px" width="155px" valign="bottom" class="whttxt"> '.$name.'</td> </tr> <tr> <td height="19px" width="155px" align="right" class="whttxt">$'.$price.' </td> </tr> <tr> <td height="202px" width="155px" align="center" colspan="2"><a href="desc/?pid='.$pid.'&cat=4" onmouseover="mover(\''.$jid.'\')" onmouseout="mout(\''.$jid.'\')"><img src="../includes/thumb.php?src='.$img.'&x=155&y=202&f=0" border="0"></a></td> </tr> </table> </td> </tr> '; $count=0; } else { $content.=' <td width="155px" height="240px" background="'.IMAGE_PATH.'bgbox.jpg" valign="top" id="'.$jid.'"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="19px" width="155px" valign="bottom" class="whttxt"> '.$name.'</td> </tr> <tr> <td height="19px" width="155px" align="right" class="whttxt">$'.$price.' </td> </tr> <tr> <td height="202px" width="155px" align="center" colspan="2"><a href="desc/?pid='.$pid.'&cat=4" onmouseover="mover(\''.$jid.'\')" onmouseout="mout(\''.$jid.'\')"><img src="../includes/thumb.php?src='.$img.'&x=155&y=202&f=0" border="0"></a></td> </tr> </table> </td> '; } } } else{ $content.='<font class="redtxt">We are in the process of adding more products, Kindly check with us later.</font>'; } ?> <script language="JavaScript"> function mover(id) { /*var obj = document.getElementById(id); alert(obj.background); obj.background='../images/bgboxhover.jpg';*/ var TableObj = document.getElementById(id); if (TableObj && TableObj.style) { TableObj.style.backgroundImage ='url("../images/bgboxhover.jpg")'; } } function mout(id) { /*var obj = document.getElementById(id); obj.background='../images/bgbox.jpg';*/ var TableObj = document.getElementById(id); if (TableObj && TableObj.style) { TableObj.style.backgroundImage ='url("../images/bgbox.jpg")'; } } </script> <!-- Body --> <td align="left" valign="top" width="75%" height="85%" > <table border="0" width="780"> <tr> <td class="btext" align="center" valign="top"><br> <table width="95%" height="100%" border="0"> <tr> <td valign="top"><IMG src="<? echo IMAGE_PATH; ?>workstations.jpg"></td> </tr> <tr> <td> </td> </tr> <tr> <td align="left"> <table border="0" cellpadding="0" cellspacing="12"> <?=$content?> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> <!-- End of body --> <? include_once("../includes/footer.php"); ?> Guys I need your help again. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 4, 2007 Share Posted December 4, 2007 When a file is included, it is inserted into the existing script as if it was in there to begin with. As such, it inherits any variables that script has created. All you need to do is to create variables for the header.php script to use. <?php <? $page_title = 'Your Office Furniture needs at Prime Office Enviroments, chairs, desks, drawers, filing and more Office Furniture'; $keywords = 'Office furniture, used office furniture, office filing, office chairs, etc...'; $page="workstations"; include_once("../includes/header.php"); $count=0; $idcount=0; $sqlSel="SELECT * from products where category='4'"; $resSel=mysql_query($sqlSel) or die (mysql_error()); $affrows =mysql_num_rows($resSel); // etc header.php <?php echo '<TITLE>' .$page_title . '</TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT="' . $keywords . '"> <META NAME="Description" CONTENT="">' ?> PhREEEk Quote Link to comment Share on other sites More sharing options...
nezona Posted December 4, 2007 Author Share Posted December 4, 2007 i have uploaded the code as below:- header.php ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> '<TITLE>' .$page_title . '</TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT="' . $keywords . '"> <META NAME="Description" CONTENT="">' ?><link href="<? echo CSS_PATH ; ?>style.css" rel="stylesheet" type="text/css"> <div id="divTopLeft" style="position:absolute"> <table height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="50"> </td> </tr> <tr> <td valign="top"> <table border="0" width="100%" cellpadding="0" cellspacing="0"> <tr> <td width="20px"> </td> <? if($page=="chairs") {?> <td align="left" valign="top"><a href="<? echo SITE_URL; ?>chairs/" class="mnselected" ><img src="<? echo IMAGE_PATH ; ?>sidemenu-chair-hover.jpg" border="0"></a> </td> <? } else {?> <td align="left" valign="top" ><a href="<? echo SITE_URL; ?>chairs/" class="snav" ><img src="<? echo IMAGE_PATH ; ?>sidemenu-chair.jpg" border="0"></a> </td> <? } ?> </tr> <tr> <td> </td> <? if ($page == "files") {?> <td align="left" valign="top"><a href="<? echo SITE_URL; ?>files/" class="mnselected" ><img src="<? echo IMAGE_PATH ; ?>sidemenu-file-hover.jpg" border="0"></a>   and one of the pages code = <? $page="workstations"; $page_title = 'Your Office Furniture needs at Prime Office Enviroments, chairs, desks, drawers, filing and more Office Furniture'; $keywords = 'Office furniture, used office furniture, office filing, office chairs, etc...'; $page="workstations"; include_once("../includes/header.php"); $count=0; $idcount=0; $sqlSel="SELECT now im getting ' . $page_title . ' - microsoft windows inexplorer in the title header Quote Link to comment Share on other sites More sharing options...
revraz Posted December 4, 2007 Share Posted December 4, 2007 You need to wrap this in PHP and use Double Quotes '<TITLE>' .$page_title . '</TITLE> Quote Link to comment Share on other sites More sharing options...
nezona Posted December 4, 2007 Author Share Posted December 4, 2007 wrap this in php, ??... have I forgot something? Quote Link to comment Share on other sites More sharing options...
revraz Posted December 4, 2007 Share Posted December 4, 2007 '<TITLE>' .$page_title . '</TITLE> to <TITLE><?php echo $page_title; ?></TITLE> or <?php echo "<title>" . $page_title . "</title>"; ?> Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 4, 2007 Share Posted December 4, 2007 Well, if you just post a snippet of the actual file, I can only modify your snippet... apparently your file is much larger than that, so probably echoing out that stuff is not most efficient. Just embed the PHP, for example: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE><?php echo $page_title; ?></TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT="<?php echo $keywords; ?>"> <META NAME="Description" CONTENT=""> You can take it from there... Please get in the habit of using long tags for PHP <?php, not <? PhREEEk Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.