The core of the portal - modules - my proporsal

The 2.0.x discussion forum has been locked; this will remain read-only. The 3.0.x discussion forum has been renamed phpBB Discussion.
Locked
scotshin7
Registered User
Posts: 328
Joined: Thu Jul 19, 2001 2:08 am
Location: Somewhere in the space/time continuum
Contact:

The core of the portal - modules - my proporsal

Post by scotshin7 » Tue Dec 04, 2001 2:57 am

I have been thinking about this for around a week or so, and I am going to post all the thoughts I have in my head here. My system uses a lot of OOP and arrays(I'm sure nobody's against arrays but I think some people are against OOP ;) ) (In objects, properties are variables and methods are functions in case you don't know)

All modules have their own objects, extended from class Module. In the module handling page, there is a function called init_modules(), which basically creates instances of all the modules, and puts them into $modules, which is an array. It also reads prefs.php inside the module's directory, and finds out whether it's "magical" or not, and other things, and also puts them into the array $modules. The array structure will be something like this - $modules["category"]["name"]["object"] . Methods, when needed, are directly called from the module handling page, like this - $modules["normal"]["news"]["object"]->constructor(); I will explain what constructor() and "normal" means later.

There are two types of modules - magical(I think I should come up with a better name) and non-magical/normal. Magical modules are things that don't really output anything, and mainly deals with the DB. Templates, auth, DBAL, user handling, groups, etc. will be "magical". They are always used on every page.

GPC variables are always suffixed by something like this - name_modname_public. "name" is the name, "modname" is the module's name, and "public" describes whether it's public or private - whether it's accessible by other modules. Other properties and methods that are to be private are prefixed by a single _, like $_private_var or _private_method().

The order the modules are called depend on their admins. They are basically called in this order - invisible/silent modules(usually magical), page header, left bar, main, right bar, and footer. The invisible/silent modules include the DBAL, which makes the connection to the DB. Sessions are also started. The page header includes the page header(obviously), and the left bar may contain navigation links, etc. The main is where the main thing happens. Depending on what page they want to look at, this is the part where news, calender, etc. will be shown. The right bar doesn't have to be included(the left bar doesn't have to be shown either, and in fact, only the invisible/silent(usually magical) modules and the main modules are required). The page footer shows, well, the page fotoer. The MAIN module is decided on the GET/POST vars passed to the module handler page.

To be continued...(probably tomorrow - December 4 9 P.M. EST) Comments are welcome on the finished section of my proposal.

--CONTINUED--

All modules/objects should have methods called constructor() and destructor() (with the exception of magical modules, they are not required). constructor() will be called something like this -
bool/void constructor(array get_vars, array post_vars, array cookie_vars)
As said earlier, some suffixes get added to GPC variables, and these suffixes are stripped off(with the exception of public vars from other modules). The function constructor() should do anything it needs to do according to the GPC variables.
destructor() is called this way - void destructor(void) It cleans up anything the module has been doing(e.g. end transactions). It is called when the module is out of use for the page(when it will not be used anymore on the page).

Administration page of the module is put into a file called admin.php(I suppose) and is still undecided whether it should be object-oriented or not. Since OOP is used extensively through the system, I think it would be better to NOT have it object-oriented. It will work similiar to phpBB's administration module system.

Oh, one more thing - events. Events are needed typically to do statistics. It think it should follow Javascript-style naming - e.g., onPageVisit, etc. I don't really have in mind how to implement THIS, but I think modules(maybe magical only) should be able to set events that other modules can use - e.g., onNewsSubmit, onSessionEnd, onSessionStart, onAuth, etc.

There's a problem with this system, though-
1. If a header needs to be sent/a cookie needs to be set in the main section of the page, it'll just spit out an error that it's impossible because output's already started.
Soultions - 1. Edit the template system somehow and implement pseudo-output buffering(it should be pretty easy)
2. Have the page header module cache everything, and echo it when is triggered by the main module

Any comments? (now that it's finished)
Last edited by scotshin7 on Wed Dec 05, 2001 2:46 am, edited 2 times in total.
Richard S.: phpBB Groupie
Always Image Search before asking questions!

User avatar
psoTFX
Former Team Member
Posts: 7425
Joined: Tue Jul 03, 2001 8:50 pm

Post by psoTFX » Tue Dec 04, 2001 12:11 pm

So you're going to re-write all of phpBB 2's functions to make them compatible with YOUR module system are YOU?

scotshin7
Registered User
Posts: 328
Joined: Thu Jul 19, 2001 2:08 am
Location: Somewhere in the space/time continuum
Contact:

Post by scotshin7 » Tue Dec 04, 2001 8:43 pm

No, just an API.
Richard S.: phpBB Groupie
Always Image Search before asking questions!

User avatar
psoTFX
Former Team Member
Posts: 7425
Joined: Tue Jul 03, 2001 8:50 pm

Post by psoTFX » Tue Dec 04, 2001 9:00 pm

So you want to write an interface layer to an interface layer ... tell me, does it make sense to make auth, sessions, templates, etc. 'modular'? Are you planning on switching them out and plugin others in? ...

scotshin7
Registered User
Posts: 328
Joined: Thu Jul 19, 2001 2:08 am
Location: Somewhere in the space/time continuum
Contact:

Post by scotshin7 » Tue Dec 04, 2001 10:49 pm

No, I personally won't be doing that, but who knows what the users are going to be doing...
Richard S.: phpBB Groupie
Always Image Search before asking questions!

User avatar
psoTFX
Former Team Member
Posts: 7425
Joined: Tue Jul 03, 2001 8:50 pm

Post by psoTFX » Tue Dec 04, 2001 10:55 pm

The idea AIUI was to use phpBB 2's core ... if you're not planning on doing this then the old 'point' comes back into play, why are 'we' supporting it? ;)

vandal
Registered User
Posts: 111
Joined: Fri Aug 10, 2001 10:37 am
Location: Berlin
Contact:

Post by vandal » Tue Dec 04, 2001 11:42 pm

don't be so afraid of modular and plugin paul ;)

all i can say is that anything is a modul in my app framework if it loads any templates

all of the rest is included as needed inside each of the modules or in the index.php (smtp, menu, time, session, template engine etc.)

the login system is a modul all though alot of the real authentication logic resides in the session class

User avatar
psoTFX
Former Team Member
Posts: 7425
Joined: Tue Jul 03, 2001 8:50 pm

Post by psoTFX » Tue Dec 04, 2001 11:48 pm

It's not a case of 'being afraid' ... it's a case of this thing, if being discussed here and being within our group framework being based on phpBB 2, it's really that simple :) As has been said more than once before, if anyone wants to create purely a CMS they should register a project @ sourceforge and move to their new home.

vandal
Registered User
Posts: 111
Joined: Fri Aug 10, 2001 10:37 am
Location: Berlin
Contact:

Post by vandal » Tue Dec 04, 2001 11:53 pm

well I don't know the internals of phpBB to really judge but you might also benefit from a modular system

this might make things for you guys much easier since you can define much cleaner API's and let the class worry about the internals

on that note:
our framework is based on each modul being a function that is supplied with an optional mode and an optional parameter that specifies if the modul should be used with a different configuration file

if you want fancy OOP in the module you can write a class inside there
but for a lot of things that is just overdoing it .. so most of our modules are not OOP (the shop is OOP for example, the news system is not ... and our news system is quite complex)

User avatar
psoTFX
Former Team Member
Posts: 7425
Joined: Tue Jul 03, 2001 8:50 pm

Post by psoTFX » Wed Dec 05, 2001 12:07 am

Okay, I've been veeeery patient over this but I must admit to getting slightly peeved at people still posting suggestions that we turn phpBB Group into 'phpPP Group' ... my own personal last word on this is what came first? phpBB or the portal, not a trick question, a very simple answer which tells you how most of the Group (AFAIK) views the 'combination' of these two projects ...

If anyone has problems with this go speak to the Project Founder ... I'm sure James will be happy to 'explain' the situation :D

Jay
Former Team Member
Posts: 807
Joined: Wed Nov 07, 2001 11:41 pm
Location: Austin, TX
Contact:

Post by Jay » Wed Dec 05, 2001 12:28 am

I don't even understand why this is still an issue.. ?!? :roll: the reason i say this is that the portal is going to use a ton of code that phpBB2 already has.. like auth, sessions, templates, db, etc.. i don't see why those things need to be modular.. IMO that's just dumb... the modular system that the portal team comes up with is more than likely going to only handle things such as adding a news system or calendar etc.. there is no reason why a user should be able to add their own auth.. if you want to do that go and rewrite all the stuff over to make it modular.. although i don't really understand why you would want to rewrite something that is already written? anyway pso is right phpBB came first and without it the portal wouldn't have even come around.. i think the rest of the developers are in agreement that the portal is going to stay under the wing of phpBB2...

scotshin7
Registered User
Posts: 328
Joined: Thu Jul 19, 2001 2:08 am
Location: Somewhere in the space/time continuum
Contact:

Post by scotshin7 » Wed Dec 05, 2001 2:46 am

My proposal have been continued, see top for more details.
Richard S.: phpBB Groupie
Always Image Search before asking questions!

vandal
Registered User
Posts: 111
Joined: Fri Aug 10, 2001 10:37 am
Location: Berlin
Contact:

Post by vandal » Wed Dec 05, 2001 10:26 am

modularization does have the ultimate gial of making things replaceable

its more about creating a basic API and also a framework onto which you can programm

such a foundation is good to establish ... so obviously creating an API makes replacement easier ... but it still may not be the reason why you want such an API or class framework (stuff like the Pear class is a good example)

but i doubt anyone is on this project to find ways to create a portal without the core components being offered by the phpBB group ... otherwise there really is no point in staying here

also most people also understood that the phpBB folks don't want to make phpBB a subproject of the phpPP

scotshin7
Registered User
Posts: 328
Joined: Thu Jul 19, 2001 2:08 am
Location: Somewhere in the space/time continuum
Contact:

Post by scotshin7 » Fri Dec 07, 2001 1:46 am

May I have some feedback from devs? You don't really seem to be giving feedback ;)
Richard S.: phpBB Groupie
Always Image Search before asking questions!

Kanuck
Former Team Member
Posts: 2791
Joined: Thu Jul 05, 2001 9:33 pm
Location: Toronto, Ontario

Post by Kanuck » Fri Dec 07, 2001 4:39 am

I have nothing to say on the subject, BartVB probably doesn't either, and Jay has already given his two cents.
Kanuck
Former phpBB.com team member

Locked

Return to “2.0.x Discussion”