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

  • SEARCH
  • Home
  • 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 6568893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:33:31+00:00 2026-05-25T14:33:31+00:00

Like this… echo $title; $title = ‘Jelly’; I only ask because I have a

  • 0

Like this…

 echo $title;

 $title = 'Jelly';

I only ask because I have a header file before that I declare the $title, on some of my pages though the page has different sections using a simple $_GET[‘tab’] === ‘blahblahblah’;

But these $_GET variables are declared after I have called the header file…

  • 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-25T14:33:32+00:00Added an answer on May 25, 2026 at 2:33 pm

    But these $_GET variables are declared after I have called the header file…

    that’s what you’re doing wrong.

    Call your header only after you’ve got all necessary data.

    You need proper site architecture for this.
    Divide your code into 3 parts:

    1. main site template (including your header)
    2. particular page template
    3. page code.

    Ans with this setup you’ll never run into problem like this.
    A typical script may look like

    <?
    //include our settings, connect to database etc.
    include dirname($_SERVER['DOCUMENT_ROOT']).'/cfg/settings.php';
    //getting required data
    $DATA=dbgetarr("SELECT * FROM links");
    // setting title for using in the main template
    $pagetitle = "Links to friend sites";
    //etc
    //set page template filename
    $tpl = "links.tpl.php";
    //and then finally call a template:
    include "main.tpl.php";
    ?>
    

    where main.tpl.php is your main site template, including common parts, like header, footer, menu etc:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>My site. <?=$pagetitle?></title>
    </head>
    <body>
    <div id="page">
    <? include $tpl ?>
    </div>
    </body>
    </html>
    

    and links.tpl.php is the actual page template:

    <h2><?=$pagetitle?></h2>
    <ul>
    <? foreach($DATA as $row): ?>
    <li><a href="<?=$row['link']?>" target="_blank"><?=$row['name']?></a></li>
    <? endforeach ?>
    <ul>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an element like this: <span class=tool_tip title=The full title>The ful&#8230;</span> This seems
Like this file ,in my opinion only declaration is enough. Can anyone explain why
Seems like this is the kind of thing that would have already been answered
Seams like this one is for real Delphi geeks only. This is how it
Something like this quiz for javascript. http://perfectionkills.com/javascript-quiz/ I have searched it but I came
Seems like this is a dumb question, but I need something... substantial. I have
Feel like this should be something easy that I'm missing. I have a table
Like seriously after going through this... Easy way to dismiss keyboard? ... I have
Like this I am currently uploading a file ( image ) in my ruby
Much like this question I want to generate an htpasswd file entry from PHP.

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.