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 8781647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:21:33+00:00 2026-06-13T20:21:33+00:00

FUNCTIONS.PHP <?php function global_header($page) { echo <!doctype html> <html lang=’en’> <head> <meta charset=’utf-8′ />

  • 0

FUNCTIONS.PHP

<?php
    function global_header($page)
    {
        echo "
        <!doctype html>
        <html lang='en'>
        <head>
            <meta charset='utf-8' />
            <title>" . $page . "</title>
            <meta name='description' content='BTI320 Assignment 2' />
        </head>
            <body>
        ";
    }
?>
<?php
    function global_footer()
    {
        echo "
            </body>
        </html>
        ";
    }
?>

When I view my page source in chrome/FF I get the following source:

    <!doctype html>
    <html lang='en'>
    <head>
        <meta charset='utf-8' />
        <title>Add</title>
        <meta name='description' content='BTI320 Assignment 2' />
    </head>
        <body>

        </body>
    </html>

It’s indented by about 3 tabs. Is there a PHP strip function or something that can align it properly? I don’t like my entire pages HTML being messed up.

My expected output is to not be indented.

  • 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-06-13T20:21:34+00:00Added an answer on June 13, 2026 at 8:21 pm

    The reason you are getting indented outputs is that you are echoing them like that…
    Simply remove the indentaions from the echo statements to get rid of them

    <?php
        function global_header($page)
        {
            echo "
    <!doctype html>
    <html lang='en'>
    <head>
    <meta charset='utf-8' />
    <title>" . $page . "</title>
    <meta name='description' content='BTI320 Assignment 2' />
    </head>
    <body>";
        }
    ?>
    <?php
        function global_footer()
        {
            echo "
    </body>
    </html>";
        }
    ?>
    

    This makes your php harder to follow fut the output will be as you requested

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

Sidebar

Related Questions

my sample code is here include 'simple_html_dom.php'; function get_all_links($url){ global $host; $html = new
I have this part of code in my functions.php: function cc_admin_enqueue_scripts($hook) { $file_dir=get_bloginfo('template_directory'); wp_enqueue_script('media-upload');
index.php <?php require_once('fr.php'); header('Location:'.abspath().directory()); ?> fr.php <?php require_once('functions.php'); ?> functions.php function abspath() { return
In wordpress's function.php the functions are written to check validate fields, return errors and
Here is the class: functions.php class buildPage { public function Set($var,$val){ $this->set->$var = $val;
I have added a function to functions.php on my theme. function insertAds($content) { $content
I'm trying to customize a core WP function using my functions.php file. Why won't
PHP functions such as 'array_map' take a callback, which can be a simple function
Let's say that there are two PHP functions. function first() { $keyword = $this->input->post('keyword');
I have this piece of code $.get('/proc.php?proc=get_color', function(data){ $('#offer_color').html(data); }); that is hosted on

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.