| 
	
 | 
 Posted by Joseph S. on 02/07/06 20:53 
Is there a system  available to do the following: 
consider an app of a few pages: 
 
page1.php: 
form1----->page3.php 
form2----->page4.php 
 
page2.php: 
form3----->page3.php 
form4----->page4.php 
 
when I am at page3.php, I do not know whether I came there from 
page1->form1 or page2->form3. 
I can check for $_SERVER['HTTP_REFERER'] and get an answer. But this 
example is simple. Let us generailze that I want an app that keeps a 
track of all the pages the user requested, in the order that they were 
sent to him. 
 
Obviously, it can be written based on sessions. Is there already some 
popular open source application for this? 
 
Also, this brings me to a broader question of page navigation rules. In 
an app made of 20-50 pages/scripts, life will be hell if there is no 
systematic approach to transferring control between pages. Is there 
some kind of structure already made and readily available into which 
you just plug-in your pages by telling some rules ? 
 
E.g. the scheme is something like: 
$ListOfPages = array( 
1=>"Main.php", 
2=>"Edit.php", 
3->"Add.php", 
.........., 
N->"Error.php"); 
 
$RuleSet = array( 
1=>array("Main.php","Edit.php","allow_edit"), 
2=>array("Main.php","Add.php","allow_add"), 
................... 
3=>array("Main.php","Error.php","my_error_handler") 
); 
The RuleSet is a set of page transfer rules based on evaluation to true 
of the specified functions, i.e., allow_edit(), allow_add(), 
my_error_handler() etc. 
Obviously, form submission is the chief means of control transfer for 
PHP programs and the use of ?op=add_something in URL's(GET) and <input 
type=hidden name=op value=add_something> (POST) are a step towards 
making some kind of structure. 
 
So the grand code will look like: 
$MyGrandAppControllerObj = new GrandAppControllerObj(); 
$MyGrandAppControllerObj->setPages($ListOfPages); 
$MyGrandAppControllerObj->setRules($RuleSet); 
$MyGrandAppControllerObj->Run(); 
 
Any links to discussions of this kind or apps or pages that do 
something like this ? 
TIA, 
JS
 
  
Navigation:
[Reply to this message] 
 |