Iosys Posted March 16, 2011 Share Posted March 16, 2011 I'm trying to control the load order of the browser. The default load order is from top to bottom. Well I have a table that is made in html with more code bellow the table. My php data that I put inside the html table is <?php include("table/table.php"); ?> that grabs the data that will go into my html table. Well the problem I'm having is that the rest of the table with stuff under the table won't load till the php is done being processed. This makes my site look weird for 4 seconds and is the reason why I want to load the php content last. Is there a way to do this with php or javascript? Quote Link to comment https://forums.phpfreaks.com/topic/230869-control-load-order-of-site/ Share on other sites More sharing options...
nicholasolsen Posted March 16, 2011 Share Posted March 16, 2011 I'm trying to control the load order of the browser. The default load order is from top to bottom. Well I have a table that is made in html with more code bellow the table. My php data that I put inside the html table is <?php include("table/table.php"); ?> that grabs the data that will go into my html table. Well the problem I'm having is that the rest of the table with stuff under the table won't load till the php is done being processed. This makes my site look weird for 4 seconds and is the reason why I want to load the php content last. Is there a way to do this with php or javascript? Do it like this: // INSERT THIS AT THE VERY TOP OF THE PAGE $table_content = include('table/table.php'); // INSIDE THE TABLE RUN THE $table_content VARIABLE AND IT WONT LOOK WEIRD.... Just a quick explanation of why you can do it like this: By adding the variable at the very start of the page, the page will have to load all of its information before moving on the loading the table. This way the loading-time of the variable is kept outside the loading of the table surrounding the information. And now you know. If you didnt understand at first :-) Hope it helps Quote Link to comment https://forums.phpfreaks.com/topic/230869-control-load-order-of-site/#findComment-1188451 Share on other sites More sharing options...
Iosys Posted March 17, 2011 Author Share Posted March 17, 2011 thanks for the reply, I'm a very new beginner with php and I'm still having issues. If I insert <?php $table_content = include('table/table.php'); ?> at the top of the paqe, the data loads first but it shows up where i insert that code Quote Link to comment https://forums.phpfreaks.com/topic/230869-control-load-order-of-site/#findComment-1188473 Share on other sites More sharing options...
nicholasolsen Posted March 17, 2011 Share Posted March 17, 2011 thanks for the reply, I'm a very new beginner with php and I'm still having issues. If I insert <?php $table_content = include('table/table.php'); ?> at the top of the paqe, the data loads first but it shows up where i insert that code Sorry about that one. Youre absolutely right, it loads right away. Well, if it takes 4 sec to load its probably a lot of content (?). The include function doesnt cause any extra delay (or at least you wont be able to notice) so you might have to get used to waiting 4 sec. Or you can try to add your data to a SQL table, but i dont think that will load any faster. And since youre new to PHP/MySQL i wouldnt recommend taking on SQL yet. I dont know what the best solution is to be honest. Hopefully some other on this forum come up with a better answer for you! And again, sorry about the confusion on the first reply. Have a nice one Quote Link to comment https://forums.phpfreaks.com/topic/230869-control-load-order-of-site/#findComment-1188508 Share on other sites More sharing options...
Iosys Posted March 17, 2011 Author Share Posted March 17, 2011 The delay isn't really the issue to me at all if I can get the things after the code to load before. I'll try to explain the problem more of why its an issue if I didn't really explain it good to begin with. The delay is bad because its blocking the rest of the page to load which to me is the layout and makes the page look weird by not showing rows or columns in the layout. When the php is done loading it does the layout in an instant which makes it look good again. My site is pvpstreams.com and you can see what i mean by looking at how it shifts to right in beginning and then goes back to center. So i'm trying to get the stuff in middle to load last, after the layout. Quote Link to comment https://forums.phpfreaks.com/topic/230869-control-load-order-of-site/#findComment-1188518 Share on other sites More sharing options...
nicholasolsen Posted March 17, 2011 Share Posted March 17, 2011 The delay isn't really the issue to me at all if I can get the things after the code to load before. I'll try to explain the problem more of why its an issue if I didn't really explain it good to begin with. The delay is bad because its blocking the rest of the page to load which to me is the layout and makes the page look weird by not showing rows or columns in the layout. When the php is done loading it does the layout in an instant which makes it look good again. My site is pvpstreams.com and you can see what i mean by looking at how it shifts to right in beginning and then goes back to center. So i'm trying to get the stuff in middle to load last, after the layout. Your website opened perfectly on my macbook,.. Took less than 0,2 sec to load all the data. Maybe its your DSL thats too slow.. Im having 2,4mbit download rate right now and thats not super fast so say at least. If you use dial-up (dont think you do, but just to mention it) or anything like this it might take several seconds to load the website for YOU, but not for anyone else. Quote Link to comment https://forums.phpfreaks.com/topic/230869-control-load-order-of-site/#findComment-1188678 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.