Need instruction. Please.
Situation: Most of my site pages start with the following:

function middle(){

My include/ has the head, title, meta tags which means they look the same on EVERY single page of my site (hundreds of pages!). Not good for SEO.

Extract from include/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>This is just a quick show etc etc ……….</head>

Question: How do I safely move the <head> to each individual page so that I can customize the title and meta tags? I do not care how long it takes me. Where do I place the <head> on the pages, before <?, after, in between?

I tried to place the <head> at the top of each page and tried MANY other things, it does not work.

Note: I still need include/ to be there since it holds lots of functions.



For the title, do this in each file:

define ("PAGE_TITLE", "Title for the Page");

And in put something like:

<title><? echo PAGE_TITLE; ?></title>

For the Meta tags, you could put together an array on each page like follows:

$page_meta_tags[] .= '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />';
$page_meta_tags[] .= '<meta name="description" content="stuff here" />';

And then in

foreach($page_meta_tags as $value) {
  echo $value;

This may need adjusting for your application, just an idea..

Your idea seemed perfect so I tried it right away. Unfortunatly I get this error. Any suggestion?

Question: Where exactly do you place the "define" function on each page? Perhaps that is my problem.



Warning: include(include/site_functions.php) [function.include]: failed to open stream: No such file or directory in /home/content/d/o/r/dornhosting/html/include/ on line 15

Warning: include() [function.include]: Failed opening 'include/site_functions.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/content/d/o/r/dornhosting/html/include/ on line 15

This is where I put the define function one the page

define ("PAGE_TITLE", "Title for the Page");
function middle(){

It is working GREAT now for the titles.

I am not sure what went wrong the first time.

Regardless ... this was the best peice of information I ever got.

THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Apparanty the below is irrelevant since you say it now works. :)

Does the file include/site_functions.php exist?

Can you post line 15 from and a few lines before and after it since this seems to be the cause of the problem if the file does exist.

If the <head> is echoed in the top() function then it should work as you have it, if it is echoed automatically by the then you should define the title before including the file.

hi there
please i want a Quick answer please
i dont know how to make the headline of my webpage move from the right to left i need it by html code please thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.