Delay loading of PHP Includes

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
user1776
Forum Newbie
Posts: 1
Joined: Wed May 21, 2008 1:26 pm

Delay loading of PHP Includes

Post by user1776 »

Hello,

I am fairly new to PHP, coming over from C#/ASP.net, I am using PHP includes to reuse code and make my web pages easier to update. I have placed my sites header, footer, sidebar and main content in external php files and am using includes to add them to my pages.

The only problem I am encountering is that my main content include seems to be loading before all of the html is finished loading, causing it to show up in the top right corner then fly over to the middle of the page (where it belongs) a few seconds later.

I know in other languages you can tell includes/scripts not to load until all of the HTML is loaded, can anyone tell me how this could be done in PHP, or offer any other suggestions?

Thanks
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Delay loading of PHP Includes

Post by Christopher »

There are a couple of ways to do that in PHP. You did not post code so it is difficult to know. It may also be a HTML thing rather than PHP. Maybe look into output buffering?
(#10850)
Post Reply