|
Posted by pf on 03/17/05 12:35
> Hi
>
> -----Original Message-----
> From: pf@sistemasdinamicos.com.ar [mailto:pf@sistemasdinamicos.com.ar]
> Sent: Thursday, March 17, 2005 10:04 AM
>
>> I'm sorry Kim, but it is possible, I've made a web hosting control panel
>> using entirely this approach and it is working very well for months now.
>> A
>> demo: http://cpdemo.sistemasdinamicos.com.ar/
>
> As I understood You wanted to create an instance of class a and directly
> access class B´s functions with $A->function_from_b();
>
> THAT is only solved if Your class A inherits from B
>
> #######################################
>
> class CDominio
> {
>
> function CDominio(&$cont)
> {
> $this->ct= &$cont;
> $this->classname=get_class($this);
> }
> #
> function CreateDomain($d,$SecLevel="1",$UserType="1") /*UserType 1)
> reseller 2) user*/
> {
> $d=trim($d);
> $new_user_id=$this->ct->syf->user_uniqid(2);
> if(!$this->ct->db->query("insert into dominios (dominio, user_id) values
> ('$d', '$new_user_id')")) {
> die(gettext("Unable to insert new domain"));
> }
>
>
> ####################################################
>
>> Look how I can access any member using the container class (which has a
>> reference to every class used in the script)
>
>> For ex: $this->ct->db->query...
>> The db class contained by ct (the container)
>> or $this->ct->cr->sess
>> the cr object (another container [contained in the ct] that contains all
>> the core classes=session, authentication, security)
>
> But is it true to OOPD? No :-) Workarounds can always be made, but then
> You miss the whole concept of OOPD and all the advantages. This is not
> easy read code, right?
>
>> Perhaps I should try php5, I was told it has MUCH BETTER objects.
>
> I think You WILL run into problems with the current code in PHP5, since it
> introduces private and
> public functions.
I dont think so, because nothing is declared private in the present code.
But OOPD is not the point, nor it benefits (I found that trying to to be
complaint with EVERY specification and rule is a whole job on itself).
The point of my post was to know if somebody knows a way to use this
approach consistently, without the oddities I've found while programming.
Anyway thanks A LOT for your answers (and your time), I'll try php5 and
see what happens.
>
> But if it works for You then that´s cool ;-)
>
> Sincerely
> Kim Madsen
>
>
Navigation:
[Reply to this message]
|