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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:17:18+00:00 2026-05-27T16:17:18+00:00

Consider the following: incl.php <div id=’footer’> <?php sleep(10); echo <div class=’footer-float’><!– content –></div>; ?>

  • 0

Consider the following:

incl.php

<div id='footer'>
  <?php
      sleep(10);
      echo "<div class='footer-float'><!-- content --></div>";
  ?>
  <div style='clear:both;'></div>
</div>

page.php

<div id='main-content'>
  <!-- normal markup structure... -->
</div>
<div id='footer-wrapper'>
  <?php include('incl.php'); ?>
</div>

I have a page (page.php) which includes a footer, the markup for which is in incl.php.
The real incl.php does some wordpress database stuff to look up latest posts and display a little blurb for each one – this works fine but because there is a delay (represented here by the sleep() command) making the database connections and including the required WP files, it can break the layout of my page as it can pause for up to several seconds.

While it is waiting, the floated divs in my footer mean that the container won’t stretch to fit the content already loaded until incl.php finishes executing and provides the clearing div needed to stretch the container.

What I’d like to know is this: is there a way I can get PHP to serve the markup (that is, the non-dynamic stuff) first rather than doing everything sequentially like it seems to at the moment?
Otherwise, is there a better way to make this less jarring? I can’t put a static height on the footer div in question as it will change depending on the content.

Any pointers much appreciated

EDIT:
Just a few points for those concerned about efficiency:

This issue crops up when I’m testing with the site running locally but the database server is remote and on the other end of an unreliable and slow net connection (if you’ve heard about ‘hurricane bawbag’ that might provide a little more context) and it is not an issue I expect to crop up much if at all in the live environment.

While points on optimising and being more efficient are appreciated, I don’t see how I can justify spending time worrying about a possible 2 second delay in loading some footer content that only crops up in the testing environment – and please don’t make the mistake of thinking that I haven’t considered performance already purely because I’ve said there is a delay in loading stuff (again – LOCAL site, REMOTE database server, SLOW connection).

For the purposes of this question, please assume that the delay isn’t the problem, rather that the problem is how to deal with possible delays without the page looking a mess.

  • 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-27T16:17:19+00:00Added an answer on May 27, 2026 at 4:17 pm

    If you want to keep the current flow without many changes you can use output buffering:

    // at the begining of your application
    ob_start();
    // rest of the application: do any kind of output
    //...
    
    // at the end, maybe at the end of the footer
    ob_end_flush();
    

    Otherwise, if you don’t want to have a blank page for a few seconds, the best solution would be to use Ajax: load the page normally (maybe with a min-height of the content with a loader), and load the results afterwards.

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

Sidebar

Related Questions

Consider following HTML, I have a div class magic inside main . The magic
Consider following example : public class SomeBusinessLayerService : DataService<MyEntityContainer> { [WebInvoke] void DoSomething(string someParam)
Consider following class class test { public: test(int x){ cout<< test \n; } };
Consider the following code: [Serializable] public class Human { public string Name { get;
Consider the following code: class Foo(var name: String = bar) Now i try to
Consider following XML document fragment: <Book> <Title>Example</Title> <Content> Some line </Content> <TOC> Again some
Consider the following Makefile: # <include global configuration Makefile> INCL = -I../include \ -I<whatever>
Consider following simple DAO example: public abstract class DAOFactory { public abstract AccountDAO getAccountDAO();
Consider following code public class City { public string Name { get { return
please consider following code #include <iostream> using namespace std; class Digit { private: int

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.