Jump to content

need to load alternate content to currently displayed site


Digitry Designs

Recommended Posts

Hello and thank you for reading.

 

Simply put, I am building my site and I currently have one page that "include_once();" several pages that hold the divs.

 

ie


<html>
<head>
<title></title>

here are all my <link rel css/text href=template/css/main.css>
                         <link rel css/text href=template/css/flash.css>
and so on
</head>

<body>

<?php

include_once('header.php');

include_once('menu.php');

include_once('content.php');

include_once('login.php');

include_once('sidebar.php');

include_once('footer.php');

</body>

<html>

 

sorry for the crudness in code but i think you get my point.

 

Now I want to click on a link from the menu and say only the content.php and sidebar.php would change without forcing the user to reload the page on every click of a link.

 

Any ideas?

 

Thank you in advance.

The only way this could be done is by using AJAX to fetch the contents of those divs and replace them.

 

Thank you for your help! Would you know a good direction to point me in? I know I can Google it, but that is what I usually do and after spending hours looking and trying, sometimes it is hard to find something that really works or is not an ad page for a book.

I appreciate your help.

I'm not especially familiar with AJAX so couldn't really say, but to be honest with you, it's best avoided, you would be better off reloading the whole page. Loading only small sections with AJAX will break browser forward/back history buttons working.

I'm not especially familiar with AJAX so couldn't really say, but to be honest with you, it's best avoided, you would be better off reloading the whole page. Loading only small sections with AJAX will break browser forward/back history buttons working.

 

Thank you for the input! is there a way to cache the images (i know there is a way to cache the images) or do you know how i would be able to cache the images for faster load time? Any input here would be very helpful. The site I am building is kind of graphic intense. Any ideas?

Thank you again.

The images aren't actually part of the page source, they are simply linked to from the source. Images are likely cached by default. If you want proper control of this you will have to delve into Apache directives to change the cache settings for images.

google: javascript preload images

as for a good ajax framework I'd suggest prototype. One reason is that if you want to get pretty, scriptaculous lays right over the top of it. For simple boxes and images I'd suggest iBox.

 

 

HTH

Teamatomic

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.