Page 1 of 1
HTML Validation regarding Title Tag
Posted: Tue Dec 12, 2006 4:20 pm
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?
Posted: Tue Dec 12, 2006 5:30 pm
by feyd
I'm not sure what exactly you mean in your statement of use; can you clarify?
Posted: Wed Dec 13, 2006 8:32 am
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]
Posted: Wed Dec 13, 2006 8:44 am
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.