partial load of a page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Bomas
Forum Newbie
Posts: 24
Joined: Sun Oct 17, 2004 2:41 am
Location: Heverlee, Belgium

partial load of a page

Post by Bomas »

i'm looking for a code that loads only a part of a page. I don't know wether it's a php code or another language. but can somebody help.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

care to explain more of what you want to do?
thegreatone2176
Forum Contributor
Posts: 102
Joined: Sun Jul 11, 2004 1:27 pm

Post by thegreatone2176 »

since you didnt post code not sure what you mean but

die;

will stop the page from loading so just put all the stuff you need before that
User avatar
Bomas
Forum Newbie
Posts: 24
Joined: Sun Oct 17, 2004 2:41 am
Location: Heverlee, Belgium

Post by Bomas »

i work with an include. i have a mainpage (index.php), in hich i load all other pages. I want now that only the pages that need to be loaded in the index, are being loaded, instead of the entire page, including the index.

here's my site:

www.forumaddict.cjb.net/MacBomas

you'll see what i mean (i hope) :?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

play with the flow control constructs available in php.. 'if' .. 'elseif' .. 'else', 'switch', etc
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

personally, I like to build an array of permitted sites, which usually can be updated via admin panel, but in this case lets create a hardcoded array for the sake of functionality... so..

Code: Select all

#list all permitted files that
     $permitted = array('mainpage','lang_eng','someotherpage');

     #check if the requested page is in the permitted array
     #check if file exists
     if (in_array($_GETї'goto'],$permitted) && file_exists($_GETї'goto']))
     {
          #include the variable 'goto'
          include($_GETї'goto'].'php');
     }
     else
     {
          #page does not exist
          include('404.php');
     }
and then your links should look like index.php?goto=anypage
User avatar
Bomas
Forum Newbie
Posts: 24
Joined: Sun Oct 17, 2004 2:41 am
Location: Heverlee, Belgium

Post by Bomas »

that's not what i mean. i use already the script to include pages into my index. but what i'm looking for is a script that only loads this pages, instead of the index + the page.

so when i want to go to register.php, it should only load register.php into my index, instead of loading the index, with the register.php page in it
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

instead of having your links like

http://page.com/?goto=register

do

http://page.com/register.php



Not quite sure what you mean..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

maybe you want something like mod_rewrite to "handle" it for you?
User avatar
Bomas
Forum Newbie
Posts: 24
Joined: Sun Oct 17, 2004 2:41 am
Location: Heverlee, Belgium

Post by Bomas »

i have my index, which cntaisn the links to all the other pages. As you can see on my site, the other pages are being included into my index.

now, i'm looking for a script that only loads the other pages into my index, instead of loading the entire page

so when i hit register, the index should stay visible, and the page inside should change that's all. is there a code for it?

i don't need a code for the include part, i have it already.

i know there are sites who use such script, but i can't find it. maybe it's a javascript, i just don't know
Post Reply