Page 1 of 1

partial load of a page

Posted: Sat Feb 26, 2005 10:25 am
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.

Posted: Sat Feb 26, 2005 10:26 am
by feyd
care to explain more of what you want to do?

Posted: Sat Feb 26, 2005 12:42 pm
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

Posted: Sun Feb 27, 2005 5:27 am
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) :?

Posted: Sun Feb 27, 2005 7:56 am
by feyd
play with the flow control constructs available in php.. 'if' .. 'elseif' .. 'else', 'switch', etc

Posted: Sun Feb 27, 2005 8:17 am
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

Posted: Mon Feb 28, 2005 3:20 pm
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

Posted: Mon Feb 28, 2005 3:25 pm
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..

Posted: Mon Feb 28, 2005 3:41 pm
by feyd
maybe you want something like mod_rewrite to "handle" it for you?

Posted: Fri Mar 04, 2005 11:00 am
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