Re: Page Structure



Garry Jones wrote:
I have recently constructed a website using a lot of php script (self taught). I now wonder if I should have construted the site in a different way.

The page contains a header (a.php) and left column (b.php) that remain constant. Depending upon which heading is clicked in a menu row the user gets different information up in the main site area (three different versions of "c"). And a footer (d.php).

What I think I have done is loading in the entire site again for each different menu heading. I load a variable according to which the contents of (c) is called.

This is the blueprint of the structure I have used.

indexc1.php does the following
Load a.php (header code)
Load b.php (left column info)
Load m.php (menu bar)
sets $var to "elephants"
Load c1.php (specific text)
(if $var is "elephants" include elephanttext.php)
(if $var is "lions" include liontext.php)
(if $var is "tigers" include liontext.php)
Load d.php (footer info)

indexc2.php does the following
Load a.php (header code)
Load b.php (left column info)
Load m.php (menu bar)
sets $var to "lions"
Load c2.php (specific text)
(if $var is "elephants" include elephanttext.php)
(if $var is "lions" include liontext.php)
(if $var is "tigers" include liontext.php)
Load d.php (footer info)

indexc3.php does the following
Load a.php (header code)
Load b.php (left column info)
Load m.php (menu bar)
sets $var to "tigers"
Load c3.php (specific text)
(if $var is "elephants" include elephanttext.php)
(if $var is "lions" include liontext.php)
(if $var is "tigers" include liontext.php)
Load d.php (footer info)

So the only difference with each index file is the value of $var.

In the menu (m.php) the user can click the buttons marked "lions", "tigers", or "elephants". (which loads in indexc1.php, indexc2.php or indexc3.php). The problem with doing things the way I have is that the page is redrawn everytime the user clicks on another heading in the menu.

I guess that I should be calling in a.php, b.php, m.php d.php just once and then that the menu should just be changing the text displayed in the main text area without redrawing the entire site. (Similar to a target tag in frames).

How is this effect created with php?

Any help appreciated

Garry Jones
Sweden








Garry,

You can't do it in just PHP without using frames. The browser doesn't have the option of only loading part of a page otherwise.

Your other choice would be to do it with some client-side language such as javascript.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.