Load .php pages in specified div area

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
dyr
Forum Newbie
Posts: 22
Joined: Fri Mar 02, 2012 2:34 pm

Load .php pages in specified div area

Post by dyr »

Hi! I'm building a layout for my website and in an effort to save loading time i'd like my header.php page and sidebar to not have to keep reloading when I travel to a new page. Is it possible to have new pages load within a set div? How would I go about this, without affecting the timeOut function (if a user is idle for 60 minutes it logs them out)?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Load .php pages in specified div area

Post by califdon »

Give us some idea of how much content is in your header and sidebar. Under typical conditions, the loading time of a header and sidebar is insignificant, compared to a 60 minute time-out. Unless you have an unusual amount of content, I would not attempt any special measures to avoid reloading, which might very likely increase the loading time.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Load .php pages in specified div area

Post by pickle »

+1. Unless you're doing some REALLY heavy lifting in the header or sidebar, I wouldn't bother trying to avoid loading them.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
dyr
Forum Newbie
Posts: 22
Joined: Fri Mar 02, 2012 2:34 pm

Re: Load .php pages in specified div area

Post by dyr »

Alright, here's what the side-bar has: display name, their amount of money, inbox link (and if there are new messages), recent posts, and a little chatter box. I think the problem is our cbox plug-in is making the whole screen flash as they travel to different pages, so I suppose I could just code one myself with ajax and that could eliminate the problem, if the speed won't make that much difference I'll trust you and not worry about it!
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Load .php pages in specified div area

Post by califdon »

That's a trivial amount of content. You may be right about the chat box, if it's a plugin there could be an issue. But my recommendation would be to just test it as it is, if you haven't already, and only change it if it produces a problem. If you find that there is noticeable delay or flashing, your approach of coding your own Ajax driven chat box sounds like a reasonable alternative. But I wouldn't assume that you have a problem prematurely.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Load .php pages in specified div area

Post by pickle »

If you want to reduce the load, you could store most of that stuff in $_SESSION & only re-load it every 5 or 10 minutes. You could also make the chat opt-in.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply