Modular PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hayden Kirk

    Modular PHP

    Hey guys

    I am about to write some back end software for my business. I want a system
    that I can create invoices, clients etc... I can do this no problem. However
    I want to write it in modules so its extendable in the future.

    Like someone else can write a module for it and it can plug stright into my
    system. I can't figure out a good way to do this in php. I was thinking of
    hooks or something, but PHP does not support this.

    Does PHP 5 have anything like this? Or does anyone else know a good way to
    do it in PHP 4?

    Any info appreciated.

    Thanks


  • Julien CROUZET aka c2c

    #2
    Re: Modular PHP

    Hayden Kirk a pensé très fort :[color=blue]
    > Hey guys
    >
    > I am about to write some back end software for my business. I want a system
    > that I can create invoices, clients etc... I can do this no problem. However
    > I want to write it in modules so its extendable in the future.
    >
    > Like someone else can write a module for it and it can plug stright into my
    > system. I can't figure out a good way to do this in php. I was thinking of
    > hooks or something, but PHP does not support this.
    >
    > Does PHP 5 have anything like this? Or does anyone else know a good way to
    > do it in PHP 4?
    >
    > Any info appreciated.
    >
    > Thanks[/color]

    You have several ways to do it, the worst way to do it is simply pass
    the
    code given to an eval(), but it is not a really good thing IMHO.

    The best "PHP" way is to implement an objet loader, so you write your
    modules
    in a class, and your core application loads it with a $object = new
    "ModuleName ";
    which of course can be replaced by a $object = new $Module_Name;

    Another "hard" way would be to code (in C) you modules, according to
    ZEND and PHP API,
    (see http://www.php.net/manual/en/zend.php and
    http://www.php.net/manual/en/api.php), so
    you could load it with dl()

    Good luck.

    --
    Julien CROUZET aka c2c
    julien_|at|_syn ten.com

    Comment

    • CountScubula

      #3
      Re: Modular PHP

      "Hayden Kirk" <spam@spam.co m> wrote in message
      news:xSE%b.2864 2$ws.3224053@ne ws02.tsnz.net.. .[color=blue]
      > Hey guys
      >
      > I am about to write some back end software for my business. I want a[/color]
      system[color=blue]
      > that I can create invoices, clients etc... I can do this no problem.[/color]
      However[color=blue]
      > I want to write it in modules so its extendable in the future.
      >
      > Like someone else can write a module for it and it can plug stright into[/color]
      my[color=blue]
      > system. I can't figure out a good way to do this in php. I was thinking of
      > hooks or something, but PHP does not support this.
      >
      > Does PHP 5 have anything like this? Or does anyone else know a good way to
      > do it in PHP 4?
      >
      > Any info appreciated.
      >
      > Thanks
      >
      >[/color]

      Well, you first need to outline what kind of things you will want to have
      available as a plug in, and define a way of comunicating with them, sorta
      like an API. you cant just have people writing code and expect it to
      intergrate. An example would be photoshop, you can write a plug in for
      images, but you can not write a plugin to change the way the photoshop
      interface works.


      So, you must decide what you want others to be able to controll, and define
      a way to pass data back and forth. Also, you must define how you want that
      module to be active, 2 aproaches:

      Aproach 1:
      have an ini.php file and have a lines that read such as this:
      $modules['style'] = "genaric.ph p";

      And allow people to edit the ini file and change the module 'generic.php'


      Aproach 2:
      set up a loader function, that will include all files in a directory

      This way, one only has to replace the style file in that directory.


      Now this is to replace functionality to a site, if you want to add
      functionality you will need to decide how you want to add items, for
      example, tools, addition pages etc.. This basicaly meens you need to do a
      good outline of what you want to acomplish first, then go from there.

      --
      Mike Bradley
      http://www.gzentools.com -- free online php tools


      Comment

      • Hayden Kirk

        #4
        Re: Modular PHP

        What im finding hard is the API

        Im use to Windows C++ Programming with API, this is much harded to do in
        PHP. How can I catch an event in PHP. Is there a way, like, if someone
        executes a function a module can pick that up and see what is happening,
        like in Windows?

        I have a basic outline of how I want to do this, but ill save you the time.
        I just can't get my head around making modules interact with my system that
        im going to design. I hope you get what I mean?

        Say if I print an invoice, I have an invoice module that someone else has
        created, can this pickup on that event?

        Thanks in advanced.


        "CountScubu la" <me@scantek.hot mail.com> wrote in message
        news:H1O%b.1797 1$4f3.13236@new ssvr29.news.pro digy.com...[color=blue]
        > "Hayden Kirk" <spam@spam.co m> wrote in message
        > news:xSE%b.2864 2$ws.3224053@ne ws02.tsnz.net.. .[color=green]
        > > Hey guys
        > >
        > > I am about to write some back end software for my business. I want a[/color]
        > system[color=green]
        > > that I can create invoices, clients etc... I can do this no problem.[/color]
        > However[color=green]
        > > I want to write it in modules so its extendable in the future.
        > >
        > > Like someone else can write a module for it and it can plug stright into[/color]
        > my[color=green]
        > > system. I can't figure out a good way to do this in php. I was thinking[/color][/color]
        of[color=blue][color=green]
        > > hooks or something, but PHP does not support this.
        > >
        > > Does PHP 5 have anything like this? Or does anyone else know a good way[/color][/color]
        to[color=blue][color=green]
        > > do it in PHP 4?
        > >
        > > Any info appreciated.
        > >
        > > Thanks
        > >
        > >[/color]
        >
        > Well, you first need to outline what kind of things you will want to have
        > available as a plug in, and define a way of comunicating with them, sorta
        > like an API. you cant just have people writing code and expect it to
        > intergrate. An example would be photoshop, you can write a plug in for
        > images, but you can not write a plugin to change the way the photoshop
        > interface works.
        >
        >
        > So, you must decide what you want others to be able to controll, and[/color]
        define[color=blue]
        > a way to pass data back and forth. Also, you must define how you want that
        > module to be active, 2 aproaches:
        >
        > Aproach 1:
        > have an ini.php file and have a lines that read such as this:
        > $modules['style'] = "genaric.ph p";
        >
        > And allow people to edit the ini file and change the module 'generic.php'
        >
        >
        > Aproach 2:
        > set up a loader function, that will include all files in a directory
        >
        > This way, one only has to replace the style file in that directory.
        >
        >
        > Now this is to replace functionality to a site, if you want to add
        > functionality you will need to decide how you want to add items, for
        > example, tools, addition pages etc.. This basicaly meens you need to do a
        > good outline of what you want to acomplish first, then go from there.
        >
        > --
        > Mike Bradley
        > http://www.gzentools.com -- free online php tools
        >
        >[/color]


        Comment

        • Tony Marston

          #5
          Re: Modular PHP

          I suggest you read one of the many books that has been written about PHP and
          how to write dynamic web sites. This is really too big a topic to answer in
          a newsgroup posting. Just visit amazon.com and type in "PHP" in the search
          box and you will astounded by the number and variety of books available.

          One thing you have to be aware of when you are attempting to learn a
          different language (as opposed to learning your first language) is that IT
          WILL BE DIFFERENT from what you already know, so don't expect them to be the
          same, to have the same functions, to have the same structure, the same
          whatever.

          Tony Marston
          This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL



          "Hayden Kirk" <spam@spam.co m> wrote in message
          news:cGO%b.2867 9$ws.3231965@ne ws02.tsnz.net.. .[color=blue]
          > What im finding hard is the API
          >
          > Im use to Windows C++ Programming with API, this is much harded to do in
          > PHP. How can I catch an event in PHP. Is there a way, like, if someone
          > executes a function a module can pick that up and see what is happening,
          > like in Windows?
          >
          > I have a basic outline of how I want to do this, but ill save you the[/color]
          time.[color=blue]
          > I just can't get my head around making modules interact with my system[/color]
          that[color=blue]
          > im going to design. I hope you get what I mean?
          >
          > Say if I print an invoice, I have an invoice module that someone else has
          > created, can this pickup on that event?
          >
          > Thanks in advanced.
          >
          >
          > "CountScubu la" <me@scantek.hot mail.com> wrote in message
          > news:H1O%b.1797 1$4f3.13236@new ssvr29.news.pro digy.com...[color=green]
          > > "Hayden Kirk" <spam@spam.co m> wrote in message
          > > news:xSE%b.2864 2$ws.3224053@ne ws02.tsnz.net.. .[color=darkred]
          > > > Hey guys
          > > >
          > > > I am about to write some back end software for my business. I want a[/color]
          > > system[color=darkred]
          > > > that I can create invoices, clients etc... I can do this no problem.[/color]
          > > However[color=darkred]
          > > > I want to write it in modules so its extendable in the future.
          > > >
          > > > Like someone else can write a module for it and it can plug stright[/color][/color][/color]
          into[color=blue][color=green]
          > > my[color=darkred]
          > > > system. I can't figure out a good way to do this in php. I was[/color][/color][/color]
          thinking[color=blue]
          > of[color=green][color=darkred]
          > > > hooks or something, but PHP does not support this.
          > > >
          > > > Does PHP 5 have anything like this? Or does anyone else know a good[/color][/color][/color]
          way[color=blue]
          > to[color=green][color=darkred]
          > > > do it in PHP 4?
          > > >
          > > > Any info appreciated.
          > > >
          > > > Thanks
          > > >
          > > >[/color]
          > >
          > > Well, you first need to outline what kind of things you will want to[/color][/color]
          have[color=blue][color=green]
          > > available as a plug in, and define a way of comunicating with them,[/color][/color]
          sorta[color=blue][color=green]
          > > like an API. you cant just have people writing code and expect it to
          > > intergrate. An example would be photoshop, you can write a plug in for
          > > images, but you can not write a plugin to change the way the photoshop
          > > interface works.
          > >
          > >
          > > So, you must decide what you want others to be able to controll, and[/color]
          > define[color=green]
          > > a way to pass data back and forth. Also, you must define how you want[/color][/color]
          that[color=blue][color=green]
          > > module to be active, 2 aproaches:
          > >
          > > Aproach 1:
          > > have an ini.php file and have a lines that read such as this:
          > > $modules['style'] = "genaric.ph p";
          > >
          > > And allow people to edit the ini file and change the module[/color][/color]
          'generic.php'[color=blue][color=green]
          > >
          > >
          > > Aproach 2:
          > > set up a loader function, that will include all files in a directory
          > >
          > > This way, one only has to replace the style file in that directory.
          > >
          > >
          > > Now this is to replace functionality to a site, if you want to add
          > > functionality you will need to decide how you want to add items, for
          > > example, tools, addition pages etc.. This basicaly meens you need to do[/color][/color]
          a[color=blue][color=green]
          > > good outline of what you want to acomplish first, then go from there.
          > >
          > > --
          > > Mike Bradley
          > > http://www.gzentools.com -- free online php tools
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • CountScubula

            #6
            Re: Modular PHP

            "Hayden Kirk" <spam@spam.co m> wrote in message
            news:cGO%b.2867 9$ws.3231965@ne ws02.tsnz.net.. .[color=blue]
            > What im finding hard is the API
            >
            > Im use to Windows C++ Programming with API, this is much harded to do in
            > PHP. How can I catch an event in PHP. Is there a way, like, if someone
            > executes a function a module can pick that up and see what is happening,
            > like in Windows?
            >
            > I have a basic outline of how I want to do this, but ill save you the[/color]
            time.[color=blue]
            > I just can't get my head around making modules interact with my system[/color]
            that[color=blue]
            > im going to design. I hope you get what I mean?
            >
            > Say if I print an invoice, I have an invoice module that someone else has
            > created, can this pickup on that event?
            >
            > Thanks in advanced.[/color]


            When I say API, I mean you should create your own. Lets take your invoice
            routine for example.

            May ways to do this, one is just pass all data via an array, simple example:

            $strArray['name'] = "john Doe";
            $strArray['skus']['1']['prod_id'] = "01";
            $strArray['skus']['1']['desc'] = "Some Widget";
            $strArray['skus']['1']['price'] = "1995";


            then call the function doCreateInvoice ($strArray)
            this function will exist in solely in a php file, that can be replaced my
            another programmer.

            Another way to do it, is to have your invoice routine call documented
            functions, and keep those functions in a seperate file, that can be replaced
            by the user.

            You have to define how the iunteraction is going to work, there are no hooks
            as in Visual C++

            Create your own API, document it, and have those functions in thier own .php
            files, and let users replace those files with thier own.

            Or, look for the existance of a file, say plugin.php if its thier, include
            it, and look for predifend functions, if there, call them, this is work
            around for hooking functions.

            --
            Mike Bradley
            http://www.gzentools.com -- free online php tools


            Comment

            • Henk Verhoeven

              #7
              Re: Modular PHP

              Alternatively you could do it the XP way, i mean:
              - think of a metaphor of what the system should be like
              - write down some requirements,
              - Write unit tests first
              - Build the simpelest thing that could possibly work
              - extend to meet more requirements
              - Refactor whenever you find youself writing the same or similar code a
              second time

              With XP there is no difference between development and maintenance, so
              when later you find new requirements, just go on extending and
              refactoring. So far it's all on http://www.extremeprogramming.org/
              and http://www.xprogramming.com/

              If you want plugins, after some time you can do meta-xp: See if there
              is a pattern in your extensions and refactorings. Analyze it, design a
              plugin api for it. Make it the simpelest plugin api that could possibly
              work. Write plugin api tests, refactor to make the new tests run (and
              the old ones too, of course). Extend and refactor as new patterns emerge.

              Of course all this does not tell you how to design & code. But all
              design really comes down to getting rid of repeated code. You could just
              start doing it and learn as you go. (But reading some books and articles
              will probably pay of soon enough, so you can do that too)

              Greetings,

              Henk Verhoeven, MetaClass.




              CountScubula wrote:
              [color=blue]
              > "Hayden Kirk" <spam@spam.co m> wrote in message
              > news:xSE%b.2864 2$ws.3224053@ne ws02.tsnz.net.. .
              >[color=green]
              >>Hey guys
              >>
              >>I am about to write some back end software for my business. I want a[/color]
              >
              > system
              >[color=green]
              >>that I can create invoices, clients etc... I can do this no problem.[/color]
              >
              > However
              >[color=green]
              >>I want to write it in modules so its extendable in the future.
              >>
              >>Like someone else can write a module for it and it can plug stright into[/color]
              >
              > my
              >[color=green]
              >>system. I can't figure out a good way to do this in php. I was thinking of
              >>hooks or something, but PHP does not support this.
              >>
              >>Does PHP 5 have anything like this? Or does anyone else know a good way to
              >>do it in PHP 4?
              >>
              >>Any info appreciated.
              >>
              >>Thanks
              >>
              >>[/color]
              >
              >
              > Well, you first need to outline what kind of things you will want to have
              > available as a plug in, and define a way of comunicating with them, sorta
              > like an API. you cant just have people writing code and expect it to
              > intergrate. An example would be photoshop, you can write a plug in for
              > images, but you can not write a plugin to change the way the photoshop
              > interface works.
              >
              >
              > So, you must decide what you want others to be able to controll, and define
              > a way to pass data back and forth. Also, you must define how you want that
              > module to be active, 2 aproaches:
              >
              > Aproach 1:
              > have an ini.php file and have a lines that read such as this:
              > $modules['style'] = "genaric.ph p";
              >
              > And allow people to edit the ini file and change the module 'generic.php'
              >
              >
              > Aproach 2:
              > set up a loader function, that will include all files in a directory
              >
              > This way, one only has to replace the style file in that directory.
              >
              >
              > Now this is to replace functionality to a site, if you want to add
              > functionality you will need to decide how you want to add items, for
              > example, tools, addition pages etc.. This basicaly meens you need to do a
              > good outline of what you want to acomplish first, then go from there.
              >
              > --
              > Mike Bradley
              > http://www.gzentools.com -- free online php tools
              >
              >[/color]

              Comment

              • Chung Leong

                #8
                Re: Modular PHP

                Uzytkownik "Hayden Kirk" <spam@spam.co m> napisal w wiadomosci
                news:cGO%b.2867 9$ws.3231965@ne ws02.tsnz.net.. .[color=blue]
                > Im use to Windows C++ Programming with API, this is much harded to do in
                > PHP. How can I catch an event in PHP. Is there a way, like, if someone
                > executes a function a module can pick that up and see what is happening,
                > like in Windows?[/color]

                Huh? I didn't know you can do that in Win32. You mean using SendMessage() or
                SetEvent()? It's been quite a while since I last looked at MFC.
                [color=blue]
                > I have a basic outline of how I want to do this, but ill save you the[/color]
                time.[color=blue]
                > I just can't get my head around making modules interact with my system[/color]
                that[color=blue]
                > im going to design. I hope you get what I mean?[/color]

                If you can't get your head around it, then maybe it's the wrong solution.
                Frankly speaking, it usually a bad sign when a programmer ponders his time
                away on a particular solution instead of thinking about how to solve the
                problem at hand.
                [color=blue]
                > Say if I print an invoice, I have an invoice module that someone else has
                > created, can this pickup on that event?[/color]

                You don't need that kind of decoupling in web programming. Don't makes
                things more complicate than it needs to be. PHP programming is fairly simple
                in general. At the end of the day, all you're doing is printing out some
                HTML code. If want to print an invoice, just build an HTML template of the
                invoice and stick in the numbers.

                When I build a site I like to take the outside-in approach: start with a
                visual mock-up, then fill in page by page the necessary functionalities ,
                writing lower level functions as the need arises. The inside-out approach
                would start from some kind of a foundation and you work your way towards the
                final result. This, I've found, usually doesn't work.


                Comment

                • Terence

                  #9
                  Re: Modular PHP

                  Hayden Kirk wrote:
                  [color=blue]
                  > What im finding hard is the API
                  >
                  > Im use to Windows C++ Programming with API, this is much harded to do in
                  > PHP. How can I catch an event in PHP. Is there a way, like, if someone
                  > executes a function a module can pick that up and see what is happening,
                  > like in Windows?
                  >
                  > I have a basic outline of how I want to do this, but ill save you the time.
                  > I just can't get my head around making modules interact with my system that
                  > im going to design. I hope you get what I mean?
                  >
                  > Say if I print an invoice, I have an invoice module that someone else has
                  > created, can this pickup on that event?
                  >
                  > Thanks in advanced.
                  >[/color]

                  I'm doing some work on an opensource PHP framework which supports the
                  modularity you are speaking of. I haven't release the event-handling
                  component yet but if you are still interested, send me an email and I
                  will send you the source.

                  Everything is done with XML, so you will want to be familiar with XSLT
                  to use the framework (I detest proprietary templating systems).

                  Basically it listens for cirtain post(or other hash) variables that you
                  declare (these are the events) in an XML file which looks like so.

                  <?xml version="1.0" encoding="UTF-8"?>
                  <xao:RequestM ap
                  xao:xmlns="http ://xao-php.sourceforge .net/schema/xao_1-0.xsd">

                  <xao:RequestS et ReqName="GameTa sks">
                  <xao:Request ReqValue="round s" Handler="Handle _GT_rounds" />
                  <xao:Request ReqValue="edit" Handler="Handle _GT_edit" />
                  <xao:Request ReqValue="close " Handler="Handle _GT_close" />
                  <xao:Request ReqValue="playe rs" Handler="Handle _GT_players" />
                  <xao:Request ReqValue="docs" Handler="Handle _GT_docs" />
                  <xao:Request ReqValue="add" Handler="Handle _GT_add" />
                  </xao:RequestSet>

                  </xao:RequestMap>

                  In the above example you might be delacring events for the variable
                  $_REQUEST["GameTasks"] but if you like, you could do

                  $arrRequests = $_POST;
                  or $arrRequests = $_REQUEST;
                  or $arrRequests = $_COOKIE;
                  or $arrRequests = $_POST["arrEvents"];
                  (where <select name="arrEvents[]" />)

                  It really doesn't matter where you get the hash from. The framework
                  checks the value of the "GameTasks" item (in this case) and then calls
                  the function itentified by the Handler attribute in the above XML,
                  passing the $arrRequests to it.

                  This is how it is called.
                  $objReqMap = new RequestMap("Req uestMap.xml");
                  $objReqMap->ExecuteRequest s(
                  new HandleGameEdit( ...),
                  $arrRequests
                  );


                  In this case, the module would be the HandleGameEdit class which
                  contains methods named after those in the Handler attributes. Here's
                  what a module make look like...

                  class HandleGameEdit extends HandlerBase {

                  function HandleGameEdit( &$objHost) {
                  $this->HandlerBase($o bjHost);
                  }

                  function Handle_GE_updat e($arrReq) {
                  $this->objHost->objLgDb->UpdateGame(
                  $arrReq["game_id"],
                  $arrReq["title"],
                  $arrReq["start_ts"],
                  $arrReq["end_ts"],
                  $arrReq["summary"]
                  );
                  }
                  }

                  You could call ExecuteRequests multiple times, if you want to, with
                  different modules (object instances) which might implement an arbitary
                  selection of the declared event-handlers.


                  when it is finally released.

                  I admit that some poeple may find this complex, but then you wouldn't be
                  using the RequestMap feature unless you were writing a complex app!

                  It's also worth noting that all the XML parsing for the request map
                  config file is only done once, it then creates a cache file containing a
                  serialize()d version of the (internal) array generated by the request
                  map file. So performance is quite good.
                  To update the request map config file with new modules, simply edit it,
                  then delete the cache file. (I could probably do this automatically by
                  checking the timestamp but that's overhead for every single hit - I'm
                  still considdering it).


                  email me for the current source if you're keen.

                  Comment

                  • Terence

                    #10
                    Re: Modular PHP

                    Hayden Kirk wrote:

                    You might also want to check out Apache Avalon



                    This is worth a read for ANY programmer.

                    Comment

                    • Brandon Blackmoor

                      #11
                      Re: Modular PHP

                      Terence wrote:[color=blue]
                      >
                      > http://avalon.apache.org
                      > This is worth a read for ANY programmer.[/color]

                      Good link! Thanks.

                      bblackmoor
                      2004-03-22

                      Comment

                      • Terence

                        #12
                        Re: Modular PHP

                        Brandon Blackmoor wrote:
                        [color=blue]
                        > Terence wrote:
                        >[color=green]
                        >>
                        >> http://avalon.apache.org
                        >> This is worth a read for ANY programmer.[/color]
                        >
                        >
                        > Good link! Thanks.
                        >
                        > bblackmoor
                        > 2004-03-22[/color]

                        You're welcome. I discovered it while doing some research into the
                        cocoon platform which uses avalon heavily.

                        Man, I gotta say, Cocoon is just nuts!!!
                        I won't be writting any new apps in PHP for a while.
                        (sac relig)

                        Apparently there is a PHP5 port called Papoon but I don't know how the
                        hell they will keep up. Cocoon is so modular in so many dimensions,
                        people are bunging new functionalities on all the time. It will take a
                        very very long time for popoon to build a codebase and community like
                        cocoon. Then there's cocoon's integration to EJBs.

                        Cocoon has a large learning curve though. PHP is probably better for
                        small apps than cocoon but I haven't seen anything in the way of
                        frameworks anywhere else which comes close. Forget Struts. I've been up
                        till 4:30am every morning this week (since last Saturday) reading up on
                        it. The sitemap, generaters, aggregators, XSPs and logic sheets -- fully
                        nuts!


                        How about this for a cataclysmic shift in web application development????

                        (use the menu on the left to navigate to subsections. at least read the
                        "continuati ons" page or you won't get the gist).
                        more info.


                        ASP.net is famous and heavily promoted for it's event driven and
                        "control" based architecture. Cocoon and ControlFlow makes ASP.net look
                        like a wet piece of toilet paper.

                        I'm looking forward to building some XUL apps with it. "There is only
                        Cocoon"

                        Comment

                        • Tony Marston

                          #13
                          Re: Modular PHP

                          If you want a PHP development infrastructure that is based around the 3 tier
                          architecture (separate layers for presentation, business logic and data
                          access) plus a variation of the MVC (Model-View-Controller) design pattern
                          then take a look at


                          In this infrastructure I also generate all HTML from XML and XSL by making
                          use of a library of reusable stylesheets and templates.

                          I have read articles on Cocoon, but I find that it is typical of the Java
                          world - over-complicated and over-engineered.

                          --
                          Tony Marston

                          This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL




                          "Terence" <tk.lists@fastm ail.fm> wrote in message news:4061435a$1 @herald...[color=blue]
                          > Brandon Blackmoor wrote:
                          >[color=green]
                          > > Terence wrote:
                          > >[color=darkred]
                          > >>
                          > >> http://avalon.apache.org
                          > >> This is worth a read for ANY programmer.[/color]
                          > >
                          > >
                          > > Good link! Thanks.
                          > >
                          > > bblackmoor
                          > > 2004-03-22[/color]
                          >
                          > You're welcome. I discovered it while doing some research into the
                          > cocoon platform which uses avalon heavily.
                          >
                          > Man, I gotta say, Cocoon is just nuts!!!
                          > I won't be writting any new apps in PHP for a while.
                          > (sac relig)
                          >
                          > Apparently there is a PHP5 port called Papoon but I don't know how the
                          > hell they will keep up. Cocoon is so modular in so many dimensions,
                          > people are bunging new functionalities on all the time. It will take a
                          > very very long time for popoon to build a codebase and community like
                          > cocoon. Then there's cocoon's integration to EJBs.
                          >
                          > Cocoon has a large learning curve though. PHP is probably better for
                          > small apps than cocoon but I haven't seen anything in the way of
                          > frameworks anywhere else which comes close. Forget Struts. I've been up
                          > till 4:30am every morning this week (since last Saturday) reading up on
                          > it. The sitemap, generaters, aggregators, XSPs and logic sheets -- fully
                          > nuts!
                          >
                          >
                          > How about this for a cataclysmic shift in web application development????
                          > http://cocoon.apache.org/2.1/userdocs/flow/index.html
                          > (use the menu on the left to navigate to subsections. at least read the
                          > "continuati ons" page or you won't get the gist).
                          > more info.
                          > http://wiki.cocoondev.org/Wiki.jsp?page=WhatIsFlow
                          >
                          > ASP.net is famous and heavily promoted for it's event driven and
                          > "control" based architecture. Cocoon and ControlFlow makes ASP.net look
                          > like a wet piece of toilet paper.
                          >
                          > I'm looking forward to building some XUL apps with it. "There is only
                          > Cocoon"[/color]


                          Comment

                          • Terence

                            #14
                            Re: Modular PHP

                            Tony Marston wrote:[color=blue]
                            > If you want a PHP development infrastructure that is based around the 3 tier
                            > architecture (separate layers for presentation, business logic and data
                            > access) plus a variation of the MVC (Model-View-Controller) design pattern
                            > then take a look at
                            > http://www.tonymarston.co.uk/php-mys...structure.html
                            >[/color]

                            I had a read through this. It is very good. On the first pass, it looks
                            a bit prescriptive but I can't say that I understand it fully without
                            having actually used it to write a real-life application.
                            [color=blue]
                            > In this infrastructure I also generate all HTML from XML and XSL by making
                            > use of a library of reusable stylesheets and templates.
                            >[/color]

                            hooray! someone who doesn't believe in using proprietary templating systems.

                            I've managed to accrue some XSL widgets but I haven't had the time to
                            organise them into a propper library yet.
                            [color=blue]
                            > I have read articles on Cocoon, but I find that it is typical of the Java
                            > world - over-complicated and over-engineered.
                            >[/color]

                            I have to say, when I first looked at cocoon, I was quite put-off by
                            having to learn the site map and I thought it was over-engeneered. But
                            since I actually invested some time into learning it, I have to say,
                            it's a joy to be able to produce results so quickly and easily. My
                            theory is that complexity is OK -- AS LONG AS IT IS JUSTIFIED.

                            In fact, you don't even need to have a firm grasp of Java to be able to
                            use it. Indeed there are many cases where no code is needed (other than
                            XSLT). You just declare stuff in the sitemap and everything just works.
                            As a newbie, I have immediately enjoyed the benefits of:

                            1) taking FULL advantage of the URL request space to declare patterns
                            for dealing with a scenario group. ie.
                            <map:match pattern="*.xml" type="wildcard" >
                            <map:generate src="xsp/{1}.xsp" type="serverpag es"/>
                            <map:serializ e type="xml"/>
                            </map:match>
                            <map:match pattern="(logon |basicSearchFor m)" type="regexp">
                            <map:aggregat e element="layout ">
                            <map:part src="cocoon:/getMenu.xml"/>
                            <map:part src="content/static/{1}.xml"/>
                            </map:aggregate>
                            <!-- one global template which includes display logic moduels
                            for difference business scenarios - plus widgets and other
                            common things like navigation -->
                            <map:transfor m src="stylesheet s/global.xsl"/>
                            <map:serializ e type="html"/>
                            </map:match>
                            <map:match pattern="*">
                            <map:aggregat e element="layout ">
                            <map:part src="cocoon:/getMenu.xml"/>
                            <map:part src="cocoon:/{1}.xml"/>
                            </map:aggregate>
                            <map:transfor m src="stylesheet s/global.xsl"/>
                            <map:serializ e/>
                            </map:match>
                            And guess what! They have a <map:generate type="PHP"/>
                            for more information, see


                            2) When I'm not using PHP to generate my source content, I have the ease
                            and simplicity of a templating language which is much like PHP. In fact,
                            you can choose which language to use including Java, Python (Jython).

                            3) Because XSP is 100% XML compliant (which can't be said for PHP), I
                            can create XSL templates which produce XSP based on tags I invented (or,
                            by leveraging XPath, even complex scenarous of other tags). These are
                            know as logicsheets (as opposed to "style"shee ts).


                            4) I can ignore XSPs alltogether if I don't like template based
                            scripting and I have a penchant for 100% Java OO applications. I can
                            just write my own genertors or actions. Doing so is NOT an "advanced"
                            technique, but just basic standard programming. Same goes for
                            transformers and serilize.

                            5) If I don't like using selectors in my sitemap (which IMHO are a bit
                            clumsy), I can use a "propper" programming paradigm to code my
                            controller. I can just pretend HTTP is a connection based protocol and
                            issue commands such as cocoon.sendPage AndWait("myPage .html",objConte xt);

                            This, I have not seen anywhere in web development before.

                            Yes, Cocoon is complex. Yes, Cocoon has a big learning curve. Yes, it is
                            worth the effort to learn. With great power comes great responsibility.
                            No, there is not much effort in building apps -- even tiny ones. and No,
                            you don't need to have Java experience (but it helps).

                            The main reason why I am embracing Cocoon, it because of the way it was
                            written -- using Avalon's Component Oriented Programming.

                            This means it is oh so simple for me to extend the framework with my own
                            Java code -- and there are extension points a-plenty in cocoon :)
                            Cocoon is more of an implementation of a "publishing " design pattern
                            which is concept oriented rather than implementation oriented. It
                            provides a logical structure for massive expansion to be handled in an
                            orderly fashion.

                            Hence all the high-level functionality that comes bundled with it (for
                            instance, XMLDB generators and logic sheets).

                            Comment

                            • Hayden Kirk

                              #15
                              Re: Modular PHP

                              Just what I was after,

                              Thanks alot :)

                              - Hayden

                              "Tony Marston" <tony@NOSPAM.de mon.co.uk> wrote in message
                              news:c3rn61$2h$ 1$830fa17d@news .demon.co.uk...[color=blue]
                              > If you want a PHP development infrastructure that is based around the 3[/color]
                              tier[color=blue]
                              > architecture (separate layers for presentation, business logic and data
                              > access) plus a variation of the MVC (Model-View-Controller) design pattern
                              > then take a look at
                              > http://www.tonymarston.co.uk/php-mys...structure.html
                              >
                              > In this infrastructure I also generate all HTML from XML and XSL by making
                              > use of a library of reusable stylesheets and templates.
                              >
                              > I have read articles on Cocoon, but I find that it is typical of the Java
                              > world - over-complicated and over-engineered.
                              >
                              > --
                              > Tony Marston
                              >
                              > http://www.tonymarston.net
                              >
                              >
                              >
                              > "Terence" <tk.lists@fastm ail.fm> wrote in message[/color]
                              news:4061435a$1 @herald...[color=blue][color=green]
                              > > Brandon Blackmoor wrote:
                              > >[color=darkred]
                              > > > Terence wrote:
                              > > >
                              > > >>
                              > > >> http://avalon.apache.org
                              > > >> This is worth a read for ANY programmer.
                              > > >
                              > > >
                              > > > Good link! Thanks.
                              > > >
                              > > > bblackmoor
                              > > > 2004-03-22[/color]
                              > >
                              > > You're welcome. I discovered it while doing some research into the
                              > > cocoon platform which uses avalon heavily.
                              > >
                              > > Man, I gotta say, Cocoon is just nuts!!!
                              > > I won't be writting any new apps in PHP for a while.
                              > > (sac relig)
                              > >
                              > > Apparently there is a PHP5 port called Papoon but I don't know how the
                              > > hell they will keep up. Cocoon is so modular in so many dimensions,
                              > > people are bunging new functionalities on all the time. It will take a
                              > > very very long time for popoon to build a codebase and community like
                              > > cocoon. Then there's cocoon's integration to EJBs.
                              > >
                              > > Cocoon has a large learning curve though. PHP is probably better for
                              > > small apps than cocoon but I haven't seen anything in the way of
                              > > frameworks anywhere else which comes close. Forget Struts. I've been up
                              > > till 4:30am every morning this week (since last Saturday) reading up on
                              > > it. The sitemap, generaters, aggregators, XSPs and logic sheets -- fully
                              > > nuts!
                              > >
                              > >
                              > > How about this for a cataclysmic shift in web application[/color][/color]
                              development????[color=blue][color=green]
                              > > http://cocoon.apache.org/2.1/userdocs/flow/index.html
                              > > (use the menu on the left to navigate to subsections. at least read the
                              > > "continuati ons" page or you won't get the gist).
                              > > more info.
                              > > http://wiki.cocoondev.org/Wiki.jsp?page=WhatIsFlow
                              > >
                              > > ASP.net is famous and heavily promoted for it's event driven and
                              > > "control" based architecture. Cocoon and ControlFlow makes ASP.net look
                              > > like a wet piece of toilet paper.
                              > >
                              > > I'm looking forward to building some XUL apps with it. "There is only
                              > > Cocoon"[/color]
                              >
                              >[/color]


                              Comment

                              Working...