|
Posted by d on 02/07/06 21:54
"Joseph S." <js_dev@rediffmail.com> wrote in message
news:1139338405.172174.153740@z14g2000cwz.googlegroups.com...
> 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
Here's one idea: Use mod_rewrite (or equivalent on IIS) to redirect all
requests for the contents of a certain directory (or entire site) to a
single PHP script. Use the original request (sent through the REQUEST_URI
header on apache, or similar header with ISAPI rewrite) to determine what
URI was requested, to figure out which script to run. Make your code
light-weight enough (caching, etc.), and you'll not notice a performance
hit. It's ridiculously easy to implement cross-site templating, without the
explicit tying-in of templates with a specific templating engine.
dave
Navigation:
[Reply to this message]
|