Solved

PHP Title Tag Inlcludes

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

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 108

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How can I do this in Pyhton? 12 75
php variable basic question 12 29
Filter wordpress query 3 13
Strip leading 0 from a var 3 14
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now