How to update only body part in the website ?

Hello Friends,
I have design a html page, it has five different parts like header, left panel, right panel, footer and body. All are common except the body, only body should be change when I click any menu or button, I dont want to use the common page code in every page. Iframe is there but iframe is not supported by every browser. So what is the alternate way to achieve this. If anyone has good idea about that kindly help me.

Thanks & Regards,

well surely your CSS with just be the same for all the header, footer, left/right…

And just add different data and css to what ever you put inside your body tag.

simple CSS on your Div’s…

Hm… are you using an external CSS file? That would make styles 20% cooler to change. [It’s a pony meme, pay no attention. xD]

Or, just use includes, or PHP to select different body cores depending on page name or just about any programming code can be used. Usually, if a section is identical on every page, I put that into an “include” file and load it on every page. For example, load your full header and menus into a file called HeaderMenus.html or PHP if programming is inside it. Then, on every page, include it. (By using the html include or PHP include commands.

What is very nice about that is a needed change is easy for all pages, just change the “include” file…

Good luck…

It matter what kind of html u use.
If u work on table’s and setting in it u should probably move to xhtml with div and external stylesheet.

Still this kind of coding works like any other I mean when u click any button it link you to other page/subepage

Now u can do in html5 same trick like in flash.

If website is not so big you can do it everything in 1 file using target to id.

here’s tutorial for this great new technology i already used and it works great!

Well, one issue with HTML5 and CSS3 is that not all browsers support them at the moment.

What I was talking about was not using ANY locked in format. A simple DIV that is loaded with your content from an “included” file. You can still use CSS, in it’s basic form without any type of odd coding. This has worked well for me and seems to work on all browsers so far as I know.

So, here is a short sample code that may help… When, a user clicks a button the new page is loaded with the same header, footer, side-panels and this code changes the content of the main area. Hope it helps…
// Sample CSS code to size the fake iFrame which is just a DIV

#contentframe{ width: 500px; height: 250px; overflow: scroll; }

// Simple DIV that would hold data based on a variable loaded from some code
// This code could be from a posted form variable or a database lookup, most anything…
$contentpage=“pages/homepage.php”; //just a made-up page as an example… (or, homepage.html…)

<?php include($contentpage) ?>

This “content” DIV could even be loaded dynamically using Javascript or Jquery. I have done that too with
little code. What is nice about that is that you can load a PHP page into it and it will handle database access
behind the scenes. Well, hope that starts you off… Good luck!

What about html5 i told,
Target to ID its support by all web browsers, webkit from this tutorial is not support only on IE (not surprise)
The only problem is when u want working it on IE 8, I put Java Script that imitate css styles and it works too.

Anyway @ErnieAlex your idea is good too :slight_smile:

Well, Szymon, I think another year or two, that everyone will aim toward HTML5 and newer CSS coding.
But, I am a computer consultant and I am on a large number of computers that do not support HTML5.
Also, I have found that many many companies and home users have Javascript closed down for security
reasons. So, the simplest way is quick often best.

I did look at the link you gave, and, it was a nice explanation of using the latest ideas. NICE!
And, it IS the way of the future. Perhaps the best way would be to check for the version of the browser
and use that to optionally pull the fanciest display for that browser.
Hmmm, now another thing to learn! :o

Just as a note on browsers, I hate IE9. It is laid out poorly for my uses. I still use IE8 for IE… So, for
HTML5 sites, I use FF. A pain to jump to a different browser, but, keeps me sane! LOL…

Still i try to write some webpages in HTML5 basics for now, cuz I still learning.
If future have to come I will work for faster cming :slight_smile:
Here’s the website i did for some “guy”
Animate shine with help java script etc.
Hope u will enjoy :slight_smile:

And btw I hope IE - DIE! :slight_smile:

Szymon, Nice!

I really liked the water droplets on the three buttons when you hover over them…
( Very nice add-on effect! )

Hope you got paid for that one! :smiley:

*** Also, Premecorp, did you finally get your code working? We got a little off-topic and I just wanted to make sure that you got further with your code. Let us know…

To get your complicated questions answered or requirements met get in touch with our expert PHP developers.

Use PHP includes or templating.

Sponsor our Newsletter | Privacy Policy | Terms of Service