Hi,
I'm using PHP for headers and footers for my web pages, I did not set it up originally but no longer had access to the person who did. It has worked quite well for quite a while and I have been able to change the information in the header and footer. But what I want to do is change the title, description and keywords depending on which page my viewers are on and I have no idea how to do it. Can anybody explain it to me? Sorry for asking such a dumb question, please have pitty on a grandmother trying to kepp up with the world.
Thank you
Sandra
8 replies to this topic
#1
Posted 24 April 2011 - 10:13 PM
|
|
|
#2
Posted 24 April 2011 - 10:40 PM
I assume each page of which will include the header and footer will look something like this in essence:
header.php:
about.php:
<?php
include('header.php');
?>
Content
<?php
include('footer.php');
?>If this were the case, you can freely pass data to the header and footer based on the page. Inside the header, simply replace each portion you wish to change dynamically with a variable, i.e.header.php:
<title> <?php echo $title; ?> </title> <meta name="keywords" content="<?php echo $keywords ?>"; ?>And then you can easily do this on your mock page.
about.php:
<?php
$title = "About page";
$keywords = "a, b, c, d, about, page";
include('header.php'); //variables are passed to the file and will replace them
?>
content
<?php
include('footer.php');
?>Of course this is purely an example, you have not stated how your page looks like code wise.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 24 April 2011 - 11:24 PM
The header I have now is huge as it holds all of the navigation bars and flyouts but I know where that starts and ends. I can put the code here if you want.
the site is
Photo Renovate - Professional Photo Restoration and Retouching Services
Thank you for your help, I get lost in all of this.
the site is
Photo Renovate - Professional Photo Restoration and Retouching Services
Thank you for your help, I get lost in all of this.
#4
Posted 25 April 2011 - 12:27 AM
I would welcome you to look at the source of that page (the HTML source of the page you had sent me) and locate where the title and description are located. I assume from your description they are static, so it should not be too hard to locate them in whichever your header file is.
As you will only be modifying the specific data, you have no need to worry about the navigation bar or other contents, it will not touch those.
Inside the header file you can find where the title and description and keywords are and modify them as I had above, you must then do my next step and define the variables $title and $keywords (or whichever you create or name) above the include() or require() call - and this will be done not in the header, but the individual pages and will be unique to what you require them to be.
As you will only be modifying the specific data, you have no need to worry about the navigation bar or other contents, it will not touch those.
Inside the header file you can find where the title and description and keywords are and modify them as I had above, you must then do my next step and define the variables $title and $keywords (or whichever you create or name) above the include() or require() call - and this will be done not in the header, but the individual pages and will be unique to what you require them to be.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#5
Posted 25 April 2011 - 05:16 AM
Oh sorry, I forgot the index page is straight HTML but most of the others use the PHP header and footer, I don't know why he did it like that. As I said somebody else did the original coding.
The following page is in PHP
Photo Renovate - Professional Photo Restoration and Retouching
It's getting late here, almost midnight, so I'll look at it in the morning.
Thank you very much for your help. It's'appreciated. :)
The following page is in PHP
Photo Renovate - Professional Photo Restoration and Retouching
It's getting late here, almost midnight, so I'll look at it in the morning.
Thank you very much for your help. It's'appreciated. :)
#6
Posted 25 April 2011 - 05:25 AM
I think this is the area I need to change
<html>
<head>
<!-- TemplateBeginEditable name="doctitle" -->
<title>Photo Renovate - Professional Photo Restoration and Retouching</title>
<META name="description" content=" Specializing in digital photo restoration, retouching and enhancement, image manipulations of all kinds, artistic treatments. We also offer special effects and CD Rom and DVD archiving services.">
<META name="keywords" content="digital art, laminating, framing, frames, archiving, family photos, photo restoration, wedding, baby, retirement, insurance, photography restoration, photo repair, photo retouching, photo fix, old photographs, colorize black and white photographs, digital photo restoration, restoration of old photo, digital photo manipulation,photo enhancement,digital photo albums, family tree, genealogy photos,photo restore,photo retouch,artistic treatment,coloration,contrast,sharpness,colour adjustment,background replace,coloration,lighting,black and white photos, photodisc, photo editing scanning,wrinkles,red eyes,framing, gift ideas, wedding gifts, retirement gifts, special effects, composite photos, collages, greyscale, torn, mildewed, water damage, stained, faded, creased, cracks, red eyes, cdrom, cd rom, cd archive, DVD, manipulation, tinting, photo gallery, portrait restoration, photo archiving, digital sketches,digital paintings, low prices, high quality">
<!-- TemplateEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="imagetoolbar" content="no">
<script language="JavaScript" type="text/JavaScript">
<html>
<head>
<!-- TemplateBeginEditable name="doctitle" -->
<title>Photo Renovate - Professional Photo Restoration and Retouching</title>
<META name="description" content=" Specializing in digital photo restoration, retouching and enhancement, image manipulations of all kinds, artistic treatments. We also offer special effects and CD Rom and DVD archiving services.">
<META name="keywords" content="digital art, laminating, framing, frames, archiving, family photos, photo restoration, wedding, baby, retirement, insurance, photography restoration, photo repair, photo retouching, photo fix, old photographs, colorize black and white photographs, digital photo restoration, restoration of old photo, digital photo manipulation,photo enhancement,digital photo albums, family tree, genealogy photos,photo restore,photo retouch,artistic treatment,coloration,contrast,sharpness,colour adjustment,background replace,coloration,lighting,black and white photos, photodisc, photo editing scanning,wrinkles,red eyes,framing, gift ideas, wedding gifts, retirement gifts, special effects, composite photos, collages, greyscale, torn, mildewed, water damage, stained, faded, creased, cracks, red eyes, cdrom, cd rom, cd archive, DVD, manipulation, tinting, photo gallery, portrait restoration, photo archiving, digital sketches,digital paintings, low prices, high quality">
<!-- TemplateEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="imagetoolbar" content="no">
<script language="JavaScript" type="text/JavaScript">
#7
Posted 25 April 2011 - 06:30 PM
Yes, you can edit what you wish:
And on the page that includes the php header, before the include() or require() statement, define those variables as I had in my first post.
<!-- TemplateBeginEditable name="doctitle" --> <title><?php echo $title ?></title> <META name="description" content="<?php echo $description ?>"> <META name="keywords" content="<?php echo $keywords ?>"> <!-- TemplateEndEditable --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="imagetoolbar" content="no"> <script language="JavaScript" type="text/JavaScript">
And on the page that includes the php header, before the include() or require() statement, define those variables as I had in my first post.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#8
Posted 25 April 2011 - 07:46 PM
Alexander:
Thank you very much. You don't know how much stress you have just released.
If I can ever help you with photo restoration or any of my services please let me know, I will look after you.
Thanks again
Kind regards
Sandra
Thank you very much. You don't know how much stress you have just released.
If I can ever help you with photo restoration or any of my services please let me know, I will look after you.
Thanks again
Kind regards
Sandra
#9
Posted 25 April 2011 - 09:15 PM
You are certainly welcome, PHP is a wonderful thing to help you make your pages dynamic, and can only be just a few lines.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









