Using Just One Entry Point For An Entire Dynamic Site

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Seun Osewa

    #1

    Using Just One Entry Point For An Entire Dynamic Site

    Hi,

    I'm thinking of an architecture for a medium-complexity dynamic site
    as follows:

    - I use one php file, say a.php as the entry point for the entire
    site. PATH_INFO allows me to pass information to my script by using
    URLs like http://mysite.com/a.php/user1000 or
    http://mysite.com/a.php/images/10.gif and perform the appropriate
    action by calling the appropriate function (which may reside in an
    included php file)

    - I use apache's url rewriting to redirect urls like
    http://mysite.com/page25 to a.php b adding the script name -


    - Using Smarty to control the actual HTML output.

    This seems to me like a sound and obvious way to do things (and also
    rarely done) so my questions are:

    - Has anyone on this group tried to do or done something like this
    before, using one entry point for the entire site for maximum control?

    - If so, what do you think are the pros and cons or this approach?

    Regards,
    Seun Osewa
  • Jochen Buennagel

    #2
    Re: Using Just One Entry Point For An Entire Dynamic Site

    Seun Osewa wrote:
    [color=blue]
    > - Has anyone on this group tried to do or done something like this
    > before, using one entry point for the entire site for maximum control?[/color]

    This pattern is known as "Front Controller" (Martin Fowler, Patterns of
    Enterprise Application Architecture), as opposed to "Page Controller",
    where you have one .php file for each "page" in the application. There
    are a good few applications that use it, like e.g. phpnuke and postnuke.
    [color=blue]
    > - If so, what do you think are the pros and cons or this approach?[/color]

    Don't have the time to go into this now, but this is a very
    controversial topic, with followers of both patterns deeply entrenched ;-)

    For a start, take a look at this article, which also has some further links:
    http://phppatterns.com/index.php/art...leview/81/1/1/

    Jochen

    Comment

    • CountScubula

      #3
      Re: Using Just One Entry Point For An Entire Dynamic Site

      "Seun Osewa" <seunosewa@inai ra.com> wrote in message
      news:ba87a3cf.0 401010958.3e0d8 fec@posting.goo gle.com...[color=blue]
      > Hi,
      >
      > I'm thinking of an architecture for a medium-complexity dynamic site
      > as follows:
      > - I use one php file, say a.php as the entry point for the entire
      > site. PATH_INFO allows me to pass information to my script by using
      > URLs like http://mysite.com/a.php/user1000 or
      > http://mysite.com/a.php/images/10.gif and perform the appropriate
      > action by calling the appropriate function (which may reside in an
      > included php file)
      > ..........
      > - Has anyone on this group tried to do or done something like this
      > before, using one entry point for the entire site for maximum control?[/color]

      I just did something like this last night as a test.

      I created a dir like this

      /mirrors/site1/content
      /mirrots/site2/content


      in each siteX dir I placed an index.php file

      then in my vurtual host conf file I put:
      <VirtualHost ......>
      ServerName site1.blablabla .com
      ServerAlias site2.blablabla .com
      DocumentRoot /mirrors/

      ErrorDocument 404 /mirrors/
      </VirtualHost>


      then I put this is /mirrors/
      index.php
      ------------------
      <?
      $h = $_SERVER['HTTP_HOST']]
      $r = $_SERVER['REQUEST_URI'];

      if ($r == "/")
      $r = "index.html ";

      if ($h == "site1.blabla.c om")
      $d = "site1";

      if ($h == "site1.blabla.c om")
      $d = "site2";

      readfile("$d$r" );
      exit();
      ?>


      then I just stuffef plain copies of .html website into the mirrors/siteX

      Now the script actualy does the serving, so I can filter it too. or do what
      every I want to each request.

      This was another one of those, can I do it, a solution, in seach of a
      problem.

      --
      Mike Bradley
      http://gzen.myhq.info -- free online php tools



      Comment

      • Seun Osewa

        #4
        Re: Using Just One Entry Point For An Entire Dynamic Site

        Thanks.

        I finally decided to go with Java because its more natural with this
        kind of design with its persistent objects and all.

        Jochen Buennagel <zang.NOSPAM@bu ennagel.com> wrote in message news:<bt1q7o$2o 2$01$1@news.t-online.com>...[color=blue]
        > Seun Osewa wrote:
        >[color=green]
        > > - Has anyone on this group tried to do or done something like this
        > > before, using one entry point for the entire site for maximum control?[/color]
        >
        > This pattern is known as "Front Controller" (Martin Fowler, Patterns of
        > Enterprise Application Architecture), as opposed to "Page Controller",
        > where you have one .php file for each "page" in the application. There
        > are a good few applications that use it, like e.g. phpnuke and postnuke.
        >[color=green]
        > > - If so, what do you think are the pros and cons or this approach?[/color]
        >
        > Don't have the time to go into this now, but this is a very
        > controversial topic, with followers of both patterns deeply entrenched ;-)
        >
        > For a start, take a look at this article, which also has some further links:
        > http://phppatterns.com/index.php/art...leview/81/1/1/
        >
        > Jochen[/color]

        Comment

        Working...