Solved

PHP Title Tag Inlcludes

Posted on 2014-11-28
4
79 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP Syntax Error 4 32
how to call a remote wordpress to use his  content in a loop 3 35
Log in through ID 5 18
Unwanted output from my query 5 15
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to create an extensible mechanism for linked drop downs.
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.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

829 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