Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Need help with OO PHP architecture problem

 
   Database Help (Home) -> PHP RSS
Next:  cannot view database object details in Access 200..  
Author Message
user3519

External


Since: Jan 27, 2005
Posts: 57



(Msg. 1) Posted: Thu Feb 17, 2005 10:39 am
Post subject: Need help with OO PHP architecture problem
Archived from groups: comp>lang>php (more info?)

I can't possibly reproduce the code for this as the 2 classes in
question are about 1500 lines each and condensing is in this case
impossible due to algorithmic logic dependencies.

Let's say you have a Class A and a Class B. Let's say Class A is like
this:

class A {

var $b;

function A() {
$this->b =& new B();
}

function getOtherUniqueStuff() {
return "this is other unique stuff";
}

function displayStuffFromB() {
$html = $this->b->displayStuff('isFromA');
}

}

-----------------------------------------------------------------

Basically, Class A will display stuff from a locally instantiated B
object property.

Here is class B:

class B {

function B() {}

function displayStuff($isFromA = false) {
$html = "blah blah blah blah";
if ($isFromA) {
$html .= A::getOtherUniqueStuff();
}
return $html;
}

}

------------------------------------------------------------------

Everything is fine and dandy, except in PHP 4.3.2 I get the following
error:

Fatal error use of undefined function getotheruniquestuff

The line that produces that error is:

[Quote]$html .= A::getOtherUniqueStuff();[/Quote]

This is why I need to get a better grip on OO PHP, I can't get past
this problem and have no solution, can someone please help?

Thanx
Phil

 >> Stay informed about: Need help with OO PHP architecture problem 
Back to top
Login to vote
Henk Verhoeven

External


Since: Mar 18, 2004
Posts: 12



(Msg. 2) Posted: Fri Feb 18, 2005 11:47 pm
Post subject: Re: Need help with OO PHP architecture problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Phil,

phillip.s.powell wrote:
 > I can't possibly reproduce the code for this as the 2 classes in
 > question are about 1500 lines each and condensing is in this case
 > impossible due to algorithmic logic dependencies.

In other words, you think architecture can not work with you code. Then
why ask for help with architecture?

Your question about the example has nothing to do with architecture.
Furthermore, I happen to have php 4.3.2 running so i tried you code, but
i do not get the error. phpInfo prints this:
PHP Version 4.3.2

System Windows NT THINKPAD 5.1 build 2600
Build Date May 28 2003 15:06:05
(...)
So i am pritty damn sure this is php 4.3.2.

I added some code to my test file to make it print some things about
what your code does. This is what i get printed by my test file (viewed
as html, then copied from the browser and pasted below here):
blah blah blah blahthis is other unique stuff
NULL

a Object
(
[b] => b Object
(
)

)

I am sorry but i can't find any problem that i can help you with.

Greetings,

Henk Verhoeven,
<a rel="nofollow" style='text-decoration: none;' href="http://www.phpPeanuts.org" target="_blank">www.phpPeanuts.org</a>

Here is the content of my test file:

<?php

class A {

var $b;

function A() {
$this->b =& new B();
}

function getOtherUniqueStuff() {
return "this is other unique stuff";
}

function displayStuffFromB() {
$html = $this->b->displayStuff('isFromA');
}

}

class B {

function B() {}

function displayStuff($isFromA = false) {
$html = "blah blah blah blah";
if ($isFromA) {
$html .= A::getOtherUniqueStuff();
}
return $html;
}

}


$temp = new A();
print $temp->b->displayStuff(true);
print "<BR>\n";
print getType($temp->displayStuffFromB());
print "<PRE>";
print_r($temp);
print "</PRE>";
?>

 >> Stay informed about: Need help with OO PHP architecture problem 
Back to top
Login to vote
user3519

External


Since: Jan 27, 2005
Posts: 57



(Msg. 3) Posted: Tue Feb 22, 2005 3:26 pm
Post subject: Re: Need help with OO PHP architecture problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanx anyway but I got it. I just call them both statically and that
prevented some form of overinstantiation of some kind.

Phil
 >> Stay informed about: Need help with OO PHP architecture problem 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
PHP System Architecture - Hi, all. I'm planning on writing an inventory application for one of my clients some time soon. However, I'm kind of confused which apropriate technologies to use. He wants the application is for inventory management to have an "employee" cl...

MYSQL Localhost restriction || Multiserver Architecture - A Paris, Le 13 Novembre de l'an MMVII, My dear Sir and Madam, Ever be in a position of too-much traffic ? Point is, if the traffic increases, then the server is slow. TOP command on a Linux/Unix/Fedora Apache/2.0.50 shows : - 50% of the CPU : for..

Do Design Patterns conflict with Layered Architecture? - I'm trying to understand how these two concepts could work together architecturally (if they can.) I realize both concepts provide benefits of re-use and ease of maintenance. Which is important when you are setting up multiple sites that are similar. ...

serious problem need help. - Hi all, I'm having troubles with my hosting and for a few reasons I can't change. So here is my problem: I receive XML files with images included in the file. I've to parse the file, save datas in a database and save images after resizing them. The..

Problem with while - I am doing the following statement to retrieve results: $response = mysql_query("select * from preguntas where tema=$tema", $db); $row = mysql_fetch_array($response); while($row = mysql_fetch_array($response)) { echo('<font face=&...
   Database Help (Home) -> PHP All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]