HTML Validation regarding Title Tag

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
SpecialK
Forum Commoner
Posts: 96
Joined: Mon Sep 18, 2006 3:49 pm

HTML Validation regarding Title Tag

Post by SpecialK »

The PHP I have taken over is using parameter to list the directory/page to display.
Ex

Code: Select all

http://www.website.com/?page=dir/page&...
I want a title to distinguish each page.

Using HTML Tidy, it is giving me an error because I am listing the title in the page file (via the FireFox validator extension). Obviously it's not supposed to be here (nested inside a DIV tag), it's supposed to be in the <head> tag. Is there a way to do this without throwing the HTML Validation issue?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'm not sure what exactly you mean in your statement of use; can you clarify?
User avatar
SpecialK
Forum Commoner
Posts: 96
Joined: Mon Sep 18, 2006 3:49 pm

Post by SpecialK »

With the querystring given, it takes an include file and inserts it into the template index.php page.

http://www.website.com/?page=dirname/pagename

Currently I have it laid out at the first line of each pagename file, a title

index.php

Code: Select all

<div id=content>

<!-- included page-->

</div>
included page

Code: Select all

<title>Website Title - PageName</title>
<!--content-->

So when they are fully put together it looks like this:

Code: Select all

<div id=content>

<!-- included page-->

<title>Website Title - PageName</title>
<!--content-->
</div>
With the way validation works, the title won't be inside of the <head> tag, thus giving me a validation warning. My goal is to ensure all the pages are 100% passing the html validation. It's not a requirement, but I would like to ensure the best work with what I do.

My thinking is I can use JavaScript to set the pagename, but I was wondering if there was an effeciant way to do this.
Note: No database is setup with these pages, but some content is managed through a database on certain pages.[/syntax]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Javascript wouldn't give you validation however.

One possible solution is in some fashion parsing out the first line of the newly included file and placing it in a title tag as part of a simple template system you build.
Post Reply