automating page navigation and control transfer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joseph S.

    #1

    automating page navigation and control transfer

    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_han dler")
    );
    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_handle r() etc.
    Obviously, form submission is the chief means of control transfer for
    PHP programs and the use of ?op=add_somethi ng in URL's(GET) and <input
    type=hidden name=op value=add_somet hing> (POST) are a step towards
    making some kind of structure.

    So the grand code will look like:
    $MyGrandAppCont rollerObj = new GrandAppControl lerObj();
    $MyGrandAppCont rollerObj->setPages($List OfPages);
    $MyGrandAppCont rollerObj->setRules($Rule Set);
    $MyGrandAppCont rollerObj->Run();

    Any links to discussions of this kind or apps or pages that do
    something like this ?
    TIA,
    JS

  • d

    #2
    Re: automating page navigation and control transfer

    "Joseph S." <js_dev@rediffm ail.com> wrote in message
    news:1139338405 .172174.153740@ z14g2000cwz.goo glegroups.com.. .[color=blue]
    > 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_han dler")
    > );
    > 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_handle r() etc.
    > Obviously, form submission is the chief means of control transfer for
    > PHP programs and the use of ?op=add_somethi ng in URL's(GET) and <input
    > type=hidden name=op value=add_somet hing> (POST) are a step towards
    > making some kind of structure.
    >
    > So the grand code will look like:
    > $MyGrandAppCont rollerObj = new GrandAppControl lerObj();
    > $MyGrandAppCont rollerObj->setPages($List OfPages);
    > $MyGrandAppCont rollerObj->setRules($Rule Set);
    > $MyGrandAppCont rollerObj->Run();
    >
    > Any links to discussions of this kind or apps or pages that do
    > something like this ?
    > TIA,
    > JS[/color]

    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


    Comment

    • Joseph S.

      #3
      Re: automating page navigation and control transfer

      Hi dave,
      d wrote:[color=blue]
      > 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[/color]

      thanks for the reply.
      what I was looking for was a "PHP framework".
      There are quite a few of them around, mostly open source, I got them by
      just googling http://www.google.com/search?q=PHP+framework
      BlueShoes, Seagull, php.MVC, AjaxAC, lots basically.

      Most of my questions are answered.

      thanks anyway.
      Regards,
      JS

      Comment

      • d

        #4
        Re: automating page navigation and control transfer

        "Joseph S." <js_dev@rediffm ail.com> wrote in message
        news:1139505820 .564471.202940@ g14g2000cwa.goo glegroups.com.. .[color=blue]
        > Hi dave,
        > d wrote:[color=green]
        >> 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[/color]
        >
        > thanks for the reply.
        > what I was looking for was a "PHP framework".
        > There are quite a few of them around, mostly open source, I got them by
        > just googling http://www.google.com/search?q=PHP+framework
        > BlueShoes, Seagull, php.MVC, AjaxAC, lots basically.
        >
        > Most of my questions are answered.
        >
        > thanks anyway.
        > Regards,
        > JS[/color]

        That's essentially all those frameworks are :) If you want to use one off
        the shelf, then you'll miss out on a lot of fun ;)


        Comment

        Working...