Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3944772
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:56:26+00:00 2026-05-20T00:56:26+00:00

Here is the structure of the web site: PHP index file //my class for

  • 0

Here is the structure of the web site:

PHP index file

//my class for analyzing the PHP query
$parameter = new LoadParameters();

//what this does is it accesses the database
//and according to the query, figures out what should be
//loaded on the page
//some of the things it sets are:
//    $parameter->design -  PHP file which contains the design
//                          HTML code of the page
//    $parameter->content - Different PHP file which should be loaded
//                          inside the design file
$parameter->mysqlGetInfo($_SERVER['QUERY_STRING']);

//load the design file
include($parameter->design);

PHP design file

Just the generic structure. Obviously it has a lot more design elements.

<html>
  <head>
     ...
  </head>
  <body>
    <?php
       //this loads the content into the design page
       include($parameter->content);
    ?>
  </body>
</html>

Question

So here is the problem I experience. The $parameter->content file is a dynamic PHP file, meaning the content also changes according to the query.

For instance if I have a image pages with queries like ?img=1 and ?img=2, my LoadParameter class will only look at the img part of the query and will know that the content of the page should be image.php. image.php however will look at the query again and figure out exactly what image to load.

This causes issues for me because I want to have a different <title></title> for different images. So my solution was just to set the <title></title> element in the content page. This works but it breaks the XHTML markup validation at W3C because it makes the structure of the site to be the following:

<html>
  <head>
     ...
  </head>
  <body>
    ...
    <title>sometitle</title>
    ...
  </body>
</html>

And having <title></title> within <body></body> is not allowed.

So how can I change the title without breaking the XHTML markup validation?

Note: I can’t use javascript because then Search engines would not be able to see the title of the page. I need to do it directly in PHP.

Thanx in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T00:56:26+00:00Added an answer on May 20, 2026 at 12:56 am

    This is how I solved the issue.

    I changed the PHP design to something like:

    //get the content PHP file
    //inside the file I set the following variables
    //which are used below:
    //$parameter->title - the string which contains the title
    //$parameter->html - the string which contains the HTML content
    include($parameter->content);
    
    //string which will contain the html code of the whole page
    $html = <<<EndHere
    <html>
      <head>
          <title>
    EndHere;
    //add title
    $html .= $parameter->title;
    $html .= <<<EndHere
          </title>
      </head>
      <body>
    EndHere;
    //add the content of the page
    $html .= $parameter->html;
    $html .= <<<EndHere
      </body>
    </html>
    EndHere;
    
    //output the html
    echo $html;
    

    And here is the basic structure of the Content PHP file. Since the only page which can possibly include the file is the my design page, I can reference $parameter in it.

    //set the title
    $parameter->title = "sometitle";
    
    //set the content HTML
    $parameter->html = "some HTML here";
    

    It’s not a very clean solution but it works fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to access various parts of a nested class structure using a arbitrary
i see a couple of questions on here and elsewhere that address this in
I've searched a long time and don't found an solution here yet. Also this
First, a little background. I have two ASP.NET web applications that use SQLServer session
I am new to the world of coding and am having a hard time
Consider the following snap on my site. The area in red is a table
I got a great response the last time I posted here. I have the
For a table with 100% reading (no writing), which structure is better and why?
update: the answer from virtualeyes (below) looks pretty nice: but now a bit code-sanititzing
I am building a firefox addon for the first time. When I try to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.