Solved

PHP Title Tag Inlcludes

Posted on 2014-11-28
4
82 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 110

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 110

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

729 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