From: Mike P. <php...@po...> - 2004-04-09 17:14:56
|
I'm new to PHPWS, but I think what I am trying to accomplish is simple. I want a module that I can pass one or two options to. The module will then pull some data from mysql and display it in a table. Before I re-invent the wheel, does this (or something similar) already exist? If not, is there a current module development howto? I'm trying to disect the Notes module as a learning exercise. Thanks, Mike... |
From: Don S. <do...@se...> - 2004-04-09 17:34:49
|
See the skeleton module, it is meant to be ... well a "skeleton" of a module. Copy it and edit away. Don. On Fri, Apr 09, 2004 at 01:14:46PM -0400, Mike Potvin wrote: > I'm new to PHPWS, but I think what I am trying to accomplish is simple. >=20 > I want a module that I can pass one or two options to. The module will > then pull some data from mysql and display it in a table. >=20 > Before I re-invent the wheel, does this (or something similar) already > exist? If not, is there a current module development howto? I'm trying > to disect the Notes module as a learning exercise. >=20 > Thanks, > Mike... >=20 >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers --=20 Reporter: "The European Union and Japan have filed a challenge in the WTO (World Trade Organization) against a rule in the Agriculture Appropriations bill that would allow steel companies to receive money from antidumping duties." Bush: "Say again now?" George W. Bush December 22, 2000 Spoken during a press conference held by the president-elect. |
From: Mike P. <php...@po...> - 2004-04-13 14:02:24
|
Thanks Don. Even the skeleton module was a bit of overkill for my current purpose (I don't need a manager), but it and the Notes module were helpful. All in all though, there appears to be a lot of useful stuff hiding inside PHPWS that would require you to pull apart many modules to discover. I was hoping there might be a howto (or two). I've managed to get a simple module together that pulls my data from a database. I'm just dumping the content now, but I plan to make it "pretty" after I learn how to use the template/output functions built in to PHPWS. Thanks, Mike... > See the skeleton module, it is meant to be ... well a "skeleton" of a > module. Copy it and edit away. > > Don. > > On Fri, Apr 09, 2004 at 01:14:46PM -0400, Mike Potvin wrote: >> I'm new to PHPWS, but I think what I am trying to accomplish is >> simple. >> >> I want a module that I can pass one or two options to. The module >> will then pull some data from mysql and display it in a table. >> >> Before I re-invent the wheel, does this (or something similar) already >> exist? If not, is there a current module development howto? I'm >> trying to disect the Notes module as a learning exercise. >> >> Thanks, >> Mike... >> >> >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by: IBM Linux Tutorials >> Free Linux tutorial presented by Daniel Robbins, President and CEO of >> GenToo technologies. Learn everything from fundamentals to system >> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >> _______________________________________________ >> Phpwebsite-developers mailing list >> Php...@li... >> https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers > > -- > Reporter: "The European Union and Japan have filed a challenge in the > WTO > (World Trade Organization) against a rule in the Agriculture > Appropriations bill that would allow steel companies to > receive money from antidumping duties." > > Bush: "Say again now?" > > George W. Bush > December 22, 2000 > Spoken during a press conference held by the president-elect. |
From: Don S. <do...@se...> - 2004-04-13 14:32:51
|
On Tue, Apr 13, 2004 at 10:02:09AM -0400, Mike Potvin wrote: > Thanks Don. Even the skeleton module was a bit of overkill for my current > purpose (I don't need a manager), but it and the Notes module were > helpful. Regardless of how simple your module might be, making use of the Item/Manager system provides a lot of flexibility and code re-use. Even if I just had a single item with a single field (much like skeleton), I would still use a Manager. Don. --=20 "I know what I believe. I will continue to articulate what I believe, and what I believe --- I believe what I believe is right." George W. Bush July 22, 2001 Comment made during visit to Rome, Italy. |
From: Mike P. <php...@po...> - 2004-04-13 15:05:01
|
Don, I guess I'm not thinking in a very PHPWS-way yet :) Help me wrap my head around this. This is how my module works: I have several links to the module in various menus. Each link passes a different parameter (in this case an author's name). The module selects rows from an sql database that match that author's name and displays the results in a table. There is no user interaction required (user or deity). What would my manager do? Mike... > Regardless of how simple your module might be, making use of the > Item/Manager system provides a lot of flexibility and code re-use. Even > if I just had a single item with a single field (much like skeleton), I > would still use a Manager. > > Don |
From: Eloi G. <el...@re...> - 2004-04-14 21:06:36
|
Right now there's 2 schools of thought on this, Mike. The Item-Manager module style came about because we wanted a way for new module developers to (1) be able to rapidly develop applications, and (2) decrease the memory usage of phpWebsite, because many module classes were loaded/kept in memory on each pageview. If all of the modules used the same base class functions (PHPWS_Manager & PHPWS_Item), then less code would have to be kept in memory. Reason #1 is invalid right now because PHPWS_Manager & PHPWS_Item are largely undocumented & uncommented. Reason #2 is partially obsolete because with version 0.9-2, module classes stopped being automatically loaded by the core, freeing module developers to more finely tune which classes get loaded when. I said *partially* because it still has a benefit for modules that operate on the same page as others. The Item-Manager module style also has some limitations -- one being that you can only take your module's capabilities so far before you have to start writing extra code to make the base classes do stuff that they're not designed to do, 'cause Item&Manager aren't just reuseable code -- it's an entire framework. The other problem is that when you have an additional level of middleware code, you also increase the execution time of the script. When that happens, the server can't handle as manu requests before it crashes. The other method of module writing is like Notes. If you need a class, you use one. You write the code to be fast and tight, doing only what *you* need it to do. You can optimize queries to reduce the workload on the database server. It's even easier to learn this way because either method requires you to learn how to use the Core classes, but you really don't ever have to look at Item or Manager if you don't want to. If you want to keep memory usage down, remember that include() and require() are your friends! If you're not using a piece of code, don't load it. Take a look at ArticleManager as a (non-definitive) example. Also, don't be afraid to unset() a variable after you're finished using it -- especially if it's using a lot of memory. Bottom line is -- you can decide for yourself which way to want to code the module. From your description it sounds so simple that it may not even need a class! You could most likely code the entire thing in /mod/yourmodule/index.php and not have your server deal with the overhead of creating a class. Geez, I kinda went off on a rant there, didn't I? -Eloi- Mike Potvin wrote: >Don, >I guess I'm not thinking in a very PHPWS-way yet :) Help me wrap my head >around this. This is how my module works: I have several links to the >module in various menus. Each link passes a different parameter (in this >case an author's name). The module selects rows from an sql database that >match that author's name and displays the results in a table. There is no >user interaction required (user or deity). What would my manager do? >Mike... > > > >>Regardless of how simple your module might be, making use of the >>Item/Manager system provides a lot of flexibility and code re-use. Even >>if I just had a single item with a single field (much like skeleton), I >>would still use a Manager. >> >>Don >> >> > > > > >------------------------------------------------------- >This SF.Net email is sponsored by: IBM Linux Tutorials >Free Linux tutorial presented by Daniel Robbins, President and CEO of >GenToo technologies. Learn everything from fundamentals to system >administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >_______________________________________________ >Phpwebsite-developers mailing list >Php...@li... >https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers > > > |
From: <po...@mi...> - 2004-04-16 16:17:14
|
Hi all. Allow me to add a few comments about the Item and Manager classes. First = of all sorry for my crappy English.=20 About half a year ago I started to develop modules for PHPWS (btw great = CMS, I love it). Just like Mike, thinking in a PHPWS-way almost gives me = constant headache. I'm feeling much better now, but I still have a lot of = unsolved questions about the right way to develop modules in PHPWS. And to clear out any comments regarding "the right way", I just want to mention, that I know there isn't really "a right way", but I'm kind of a standardization freak (working as a Java Architect), and love = frameworks, code reuse, templates, and a standard way of coding. So I tend to spend = a great amount of time on this issue. Rather than just coding modules in my own way, my goal has been to adopt = the PHPWS way of coding and thinking, and to reuse as much "core" code as possible. I agree with Don regarding the use of the Item and Manager classes, and to overcome the lack of documentation, I've looked through = all the mods which make use of these classes, including the Skeleton module. Right now I have a problem with the Item and Manager classes, similar to Mike=92s problem. My current module displays a list of items. Each item = has a related list of items. It looks something like this: Manager (containing item A, B and C) -- Item (B) -- Manager (for item B: = B1, B2 and B3) -- Item (B1) This structure is just like the photoalbum module, where you can have a = lot of albums, and each album can contain a lot of photos. To show the first list, I use the Item and Manager classes. When the = user select an instance (e.g. item B), I need a new Item and Manager = relationship to show the detail list with information limited to the selected main = item. I think this should be done by creating an instance of the Manager class with the ability to limit the selection through a parameterized = constructor, just like in the Item class. Any ideas how to solve the problem the most elegant way? I think (like = Mike) that it's a very simple and common task, which should be, if it=92s not = adding to many disadvantages, taken care of by the standard PHPWS = implementation (no criticism here, just a nice request :-). There is a possibility that the Item and Manager classes already has a = way of dealing with this functionality, and that I have overlooked the implementation. If someone could provide the solution, whether or not I = have to code the solution myself, I would be very grateful. Another problem which has raised when coding my module is the task of validating the user input. If some mandatory information is missing, or = some of the submitted information doesn=92t follow the correct format, the = user must be provided with an error message, and probably the opportunity to correct the input. This is not very easy to generalize, but I think a = lot of module developers would be very grateful, if the Skeleton module could = be extended further with examples of how to solve this task. I have come around the validation in my own module by storing all = submitted variables, doing the validation, and if some error arise, displaying = exactly the same page, including the user input (the last part is very important = for a usability aspect). The Skeleton module (and as far as I know, all of = the other PHPWS mods), throw away the user input, and displays the same = input page, unfortunately empty. One last thing - to all of you thinking about developing your own = modules, don't underestimate the power of the Item and Manager classes, just = because some functionality may be missing. Like Don said, making use of the Item = and Manager classes provides a lot of flexibility and code reuse. My advice = is to spend the time it takes, getting to know how to implement and use = these classes. And to the PHPWS team - thanks for the effort and excellent framework so far. Please keep up the good work. - Michael > -----Oprindelig meddelelse----- > Fra: php...@li... = [mailto:phpwebsite- > dev...@li...] P=E5 vegne af Eloi George > Sendt: 14. april 2004 23:05 > Cc: Php...@li... > Emne: Re: [Phpwebsite-developers] Simple Module >=20 > Right now there's 2 schools of thought on this, Mike. >=20 > The Item-Manager module style came about because we wanted a way for > new module developers to > (1) be able to rapidly develop applications, and > (2) decrease the memory usage of phpWebsite, because many module = classes > were loaded/kept in memory on each pageview. If all of the modules = used > the same base class functions (PHPWS_Manager & PHPWS_Item), then less > code would have to be kept in memory. >=20 > Reason #1 is invalid right now because PHPWS_Manager & PHPWS_Item are > largely undocumented & uncommented. > Reason #2 is partially obsolete because with version 0.9-2, module > classes stopped being automatically loaded by the core, freeing module > developers to more finely tune which classes get loaded when. I said > *partially* because it still has a benefit for modules that operate on > the same page as others. >=20 > The Item-Manager module style also has some limitations -- one being > that you can only take your module's capabilities so far before you = have > to start writing extra code to make the base classes do stuff that > they're not designed to do, 'cause Item&Manager aren't just reuseable > code -- it's an entire framework. The other problem is that when you > have an additional level of middleware code, you also increase the > execution time of the script. When that happens, the server can't > handle as manu requests before it crashes. >=20 > The other method of module writing is like Notes. If you need a = class, > you use one. You write the code to be fast and tight, doing only what > *you* need it to do. You can optimize queries to reduce the workload = on > the database server. It's even easier to learn this way because = either > method requires you to learn how to use the Core classes, but you = really > don't ever have to look at Item or Manager if you don't want to. >=20 > If you want to keep memory usage down, remember that include() and > require() are your friends! If you're not using a piece of code, = don't > load it. Take a look at ArticleManager as a (non-definitive) example. > Also, don't be afraid to unset() a variable after you're finished = using > it -- especially if it's using a lot of memory. >=20 > Bottom line is -- you can decide for yourself which way to want to = code > the module. From your description it sounds so simple that it may not > even need a class! You could most likely code the entire thing in > /mod/yourmodule/index.php and not have your server deal with the > overhead of creating a class. >=20 > Geez, I kinda went off on a rant there, didn't I? > -Eloi- >=20 >=20 > Mike Potvin wrote: >=20 > >Don, > >I guess I'm not thinking in a very PHPWS-way yet :) Help me wrap my = head > >around this. This is how my module works: I have several links to = the > >module in various menus. Each link passes a different parameter (in = this > >case an author's name). The module selects rows from an sql database > that > >match that author's name and displays the results in a table. There = is > no > >user interaction required (user or deity). What would my manager do? > >Mike... > > > > > > > >>Regardless of how simple your module might be, making use of the > >>Item/Manager system provides a lot of flexibility and code re-use. = Even > >>if I just had a single item with a single field (much like = skeleton), I > >>would still use a Manager. > >> > >>Don > >> > >> |
From: Matthew M. <ma...@tu...> - 2004-04-16 17:12:29
|
Item and Manager are not always the way to go. Sometimes item is overkill. Same for Manager. BTW there is an instanced Manager class called List. Works much the same way but is more flexible. Item may get easier to use come 0.9.4. I have played around with it some in the 0.9.4 cvs code. More tinkering may be in the works. -- Matthew McNaney Internet Systems Architect Electronic Student Services Appalachian State University Phone: 828-262-6493 http://phpwebsite.appstate.edu http://ess.appstate.edu |