开发者

Designing a container page

开发者 https://www.devze.com 2023-03-17 00:12 出处:网络
Are there any potentiall pitfalls with the following idea: ...I want to have one container page, index.php. The header and outlines will be constant but in the middle I want one big panel, which loa

Are there any potentiall pitfalls with the following idea:

...I want to have one container page, index.php. The header and outlines will be constant but in the middle I want one big panel, which loads its content from external php files,开发者_StackOverflow one for each "slide". When a user click a link, the central div will update with the new content, the outer edge will remain unchanged.

Will I be able to use session variables, etc correctly with the set-up. I realise it will certainly break the browser history but other than some possible UI issues, are there any techincal barriers.


This is a common thing, as Jared stated. Session variables are always available through ajax or frames, so it shouldn't affect anything there, and if browser history is something you would like to continue to use, you could always change your location.hash when you load new content so that you can load previously rendered content with some javascript if someone uses the back or forward buttons.


The session should not be lost.

The browser history does not need to be lost also - please read about onPopState (and history.pushState) and onHashChange JS events. The AJAX-heavy sites can determine the content to be loaded that way.

One of the pitfails is, if you are using a lot of JS, that the events for the newly loaded content will need to be re-attached, but they can also be delegated from the container which is not replaced.

jQuery's .load() function may be also useful to you to get started.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号