473,769 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with OO PHP architecture problem

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 getOtherUniqueS tuff() {
return "this is other unique stuff";
}

function displayStuffFro mB() {
$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($i sFromA = false) {
$html = "blah blah blah blah";
if ($isFromA) {
$html .= A::getOtherUniq ueStuff();
}
return $html;
}

}

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

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

Fatal error use of undefined function getotheruniques tuff

The line that produces that error is:

$html .= A::getOtherUniq ueStuff();
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

Jul 17 '05 #1
2 1578
Hi Phil,

phillip.s.powel l 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,
www.phpPeanuts.org

Here is the content of my test file:

<?php

class A {

var $b;

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

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

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

}

class B {

function B() {}

function displayStuff($i sFromA = false) {
$html = "blah blah blah blah";
if ($isFromA) {
$html .= A::getOtherUniq ueStuff();
}
return $html;
}

}
$temp = new A();
print $temp->b->displayStuff(t rue);
print "<BR>\n";
print getType($temp->displayStuffFr omB());
print "<PRE>";
print_r($temp);
print "</PRE>";
?>
Jul 17 '05 #2
Thanx anyway but I got it. I just call them both statically and that
prevented some form of overinstantiati on of some kind.

Phil

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1307
by: David2511 | last post by:
Hello, I need a little help. I try to write the following architecture : an abstract template class A Two classes derived from class A : the classes B and C which are concrete. The class A contains a static method called CreateA which allows to
0
1045
by: Julia | last post by:
I need help with architecture design,please: I have a server which constantly downloading messages from the internet and store them inside a data base. the server have two administrators options: one is a local windows application,and the second is a web application The administrator can either delete messages,add new messages,and send messages
3
14520
by: RAJESH | last post by:
I am working with c# and asp.net in developing web applications, iam using ..netframework 1.1 ,i want to know what is the need of 3-tier or 4-tier architecture in our application development.what is its part when some body is using our application.plese give links where i can find the answer.
3
1639
by: Julia | last post by:
I need help with architecture design,please: I have a server which constantly downloading messages from the internet and store them inside a data base. the server have two administrators options: one is a local windows application,and the second is a web application The administrator can either delete messages,add new messages,and send messages
0
3348
by: Ewart MacLucas | last post by:
generated some WMI managed classes using the downloadable extensions for vs2003 from mircrosoft downloads; wrote some test code to enumerate the physicall processors and it works a treat, but a question.. The code fails with the error that: "Additional information: COM object that has been separated from its underlying RCW can not be used." if I make a call to pc.Count before iterating though the objects. Dim d As New...
10
1489
by: pcthug | last post by:
Hi All, I am creating multi-tier app in vb.net using visual studio .net. I create a invoice.vb class file with properties, events and methods. This also has a line item collection class (lineitem.vb & lineitems.vb). I create a form (form1.frm) and write the corresponding code to initialize an invoice object, there are textboxes on the form to display the data, an update and load button. My data is stored in an access database.
0
4930
by: srikar | last post by:
Hi all, I am having a problem, when I am compiling the code in 32 bit option on a 64 bit machine using the macro CPPFLAGS= -m32 I am getting the following warnings from the linker . /`../bin/amd64_stat_gnu_02015/WriteFault.o' is incompatible with i386:x86-64 output /usr/bin/ld: warning: i386 architecture of input file `../bin/amd64_stat_gnu_02015/WriteLogic.o' is incompatible with i386:x86-64 output /usr/bin/ld: warning: i386...
0
1951
by: mandarkraftware | last post by:
Hi All, Let me present you with list of consultants currently available. Name / Job Title Summary Ramchandran/Java · 7+ years experience in the field of Software Development. · Expertise in full Software Development Life Cycle (SDLC)
2
2050
by: jmDesktop | last post by:
I'm using C#, but I don't know that it matters for this question. I know that many experienced folks are on here, so sorry for being off topic. I am finally at a point where I want to and I think able to design software that is modular and pluggable. The only problem is that I'm not sure if I need to or if this lends itself to it. I have a project that requires building a scheduler. It's more of a virtual take number program as in...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10038
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7404
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3952
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.