Solved

PHP Title Tag Inlcludes

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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 …

740 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