Solved

PHP Title Tag Inlcludes

Posted on 2014-11-28
4
78 Views
Last Modified: 2015-03-06
I have a simple PHP website that I am currently doing SEO work on. I can see that the website was built with PHP and need some help on how to code the Meta Data. I can see that the site has Main Pages, Sub Pages and Includes which makes it hard for me to find where to put the data since they all mash together.

The Content.php page has the include to all other pages for the meta data which reads...

<?php 
	include ('includes/init.php'); 
	//if (count($pagesArray[$subIndex][2]) != null) //has subsections
	include ('includes/pages/'.$page.'.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Glos Associates Inc. | <?php echo $title; ?></title>
		<link rel="shortcut icon" href="favicon.ico" />
		<link href='http://fonts.googleapis.com/css?family=Lustria' rel='stylesheet' type='text/css'>
		<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
		<link href="jquery.minitwitter.css" media="all" rel="stylesheet" type="text/css"/> 
	</head>
	<body>

Open in new window


I am trying to individually Title each page and have separate descriptions for each. How do I do that with PHP using the <title>Glos Associates Inc. | <?php echo $title; ?></title>  include?

Should I delete all information in the content.php file and do each one separate or use some sort of include.

please see the website and the data that I have added. You can see that I am getting errors because they are 2 instances of Head tags, ect...

http://www.glosassociates.com
0
Comment
Question by:fadercreep
  • 2
  • 2
4 Comments
 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 500 total points
ID: 40470849
I think you need a professional PHP developer to help you.  Once a site has gotten the PHP and HTML all mixed up like this one it's a candidate for refactoring, and without doing that, you won't really be able to get what you want.

Consider this statement:

<title>Glos Associates Inc. | <?php echo $title; ?></title>

What that is saying to the server is, "Send part of the HTML title tag to the browser, then start up PHP.  Once PHP starts, find the variable named $title and send it to the browser, then stop PHP.  After that, the server sends the </title> statement and an end-of-line character.

What you'll need to do is make the PHP script aware of the data needed in the $title variable.  The source of this data is up to the designer of the app - it might come from a variety of places.  The PHP script(s) will need to load the appropriate values into the $title variable before this line of code is executed.
0
 

Author Comment

by:fadercreep
ID: 40473819
Thanks Ray for the tips:

Your Response:
The PHP script(s) will need to load the appropriate values into the $title variable before this line of code is executed.

My Question:
I am know HTML and advanced coding, just not 110% on my php. I understand the PHP Call to pull in the title, but what syntax do I use on the other pages to input the meta title?

Something like this?
$title = "Biographies of Company Executives : "
0
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 40475146
...what syntax do I use on the other pages to input the meta title?...
This is why I recommend that you consider getting professional PHP help.  Each page will have its own HTML <title> but there will be a data organization task for the part of this application that maps the PHP data organization to the HTML data organization.  It's not a question with any succinct answer -- it's a requirement for application development and for that you really need the services of an application developer.  For the experienced developer this is not a difficult task and it will not cost you very much money to get a very good implementation.
0
 

Author Comment

by:fadercreep
ID: 40479409
looking for the real answer, thanks. I know code, I will do it with the help of the right answer.
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question