Hello,
I have this class http://pastebin.com/807571, where I set some variables on
__construct. Originaly I set the $total_? variables when the function
showLayout() was called. I know pastebin is having problems, so if you can't
get the code, I will upload it in plain text on my own server.
This function is called from a page object, which is called from a
controller and so on.
Doing it this way meant that all variables set during the showLayout()
function, were set to null, next time I opened the object.
Then I set it up like it is now, where I set all call variables doring
__construct and this worked fine.
But now the problem is, that the last values added to the class variables
from the showLayout() function are not added.
Is this a bug in PHP5 or am I doing something terribly wrong here?
Best regards, tatsudoshi
Oct 16 '06
15 1485
tatsudoshi wrote:
----- Original Message -----
From: "Jerry Stuckle" <js*******@attg lobal.net>
Newsgroups: comp.lang.php
Sent: Tuesday, October 17, 2006 4:45 AM
Subject: Re: Class variable problem
>>The real question here is - how are you opening the object? Are you creating a second object or are you referencing the existing object.
The code you're using to access it is also very important.
-- ============= ===== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. js*******@att global.net ============= =====
Your ansewer is message Re: Class variable problem : 17-10-2006 08:42
Sorry :-/
(Top posting fixed)
Sorry, I don't see where you're showing the code you use to save and
restore the object. You indicate you're using the session, but that's
all. What's the actual code you're using?
This would be a lot easier if you could create a simplified case where
we could see exactly what you're trying to do. It's very difficult to
go through hundreds of lines of code to understand what someone else is
doing in a few minutes of spare time :-)
Also, a couple of tips. Please don't top post - this newsgroup uses
bottom posting (like this) or inline posting (responses mixed in and
immediately after the question) as a standard.
Also - I found the message you referenced. But I'm in a different time
zone. To me your message was posted at 2:42 AM.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
"Jerry Stuckle" <js*******@attg lobal.netskrev i en meddelelse
news:QY******** *************** *******@comcast .com...
tatsudoshi wrote:
>----- Original Message ----- From: "Jerry Stuckle" <js*******@attg lobal.net> Newsgroups: comp.lang.php Sent: Tuesday, October 17, 2006 4:45 AM Subject: Re: Class variable problem
>>>The real question here is - how are you opening the object? Are you creating a second object or are you referencing the existing object.
The code you're using to access it is also very important.
-- ============ ====== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. js*******@at tglobal.net ============ ======
Your ansewer is message Re: Class variable problem : 17-10-2006 08:42 Sorry :-/
(Top posting fixed)
Sorry, I don't see where you're showing the code you use to save and
restore the object. You indicate you're using the session, but that's
all. What's the actual code you're using?
This would be a lot easier if you could create a simplified case where we
could see exactly what you're trying to do. It's very difficult to go
through hundreds of lines of code to understand what someone else is doing
in a few minutes of spare time :-)
Also, a couple of tips. Please don't top post - this newsgroup uses
bottom posting (like this) or inline posting (responses mixed in and
immediately after the question) as a standard.
Also - I found the message you referenced. But I'm in a different time
zone. To me your message was posted at 2:42 AM.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
I see. Thanks for the tips. I will make a simple example when I get home :-)
tatsudoshi wrote:
----- Original Message -----
From: "Colin Fine" <ne**@kindness. demon.co.uk>
Newsgroups: comp.lang.php
Sent: Monday, October 16, 2006 11:48 PM
Subject: Re: Class variable problem
>You'll need to be more explicit about what you're expecting to see, and what you are seeing.
I thought it might be a problem with references (in PHP5 Objects are copied by references, but arrays are not) but I can't see a place where you're assigning to a copied array, so it doesn't appear to be that.
Colin
(top-posting corrected)
I am not using references at all, as I have not been able to figure
out how
it works in the different versions of PHP.
No, I can see you aren't, and as far as I can see there is nowhere in
the code you posted where you should be.
If you had anything like
$row = $this->array[$index]
and then
$row[] = 2;
then you would need to make $row a reference otherwise the assignment to
a member of row would be to a copy and not to the original in $this->array.
This is true in both PHP4 and PHP5; but if the contents of
$this->array[$index] were itself an object (rather than an array), then
you would need to use a reference in PHP4, but not in PHP5.
You still haven't told us, AFAICS, precisely what result you are getting
and how it differs from what you expect.
Colin
Jerry Stuckle wrote:
tatsudoshi wrote:
>Sorry for messing up the messages. I have never tryed using newsgroups before. Is it possible to delete a message from the group?
No, you can't delete a message from a newsgroup. It's on hundreds of
servers all over the world.
Well, you can try to cancel the message, which will work with significant
delay on some servers, and then only for the users that haven't downloaded
it already. Confusion all around, it's a marvelous thing.
Grtz,
--
Rik Wasmus
Rik wrote:
Jerry Stuckle wrote:
>>tatsudoshi wrote:
>>>Sorry for messing up the messages. I have never tryed using newsgroups before. Is it possible to delete a message from the group?
No, you can't delete a message from a newsgroup. It's on hundreds of servers all over the world.
Well, you can try to cancel the message, which will work with significant
delay on some servers, and then only for the users that haven't downloaded
it already. Confusion all around, it's a marvelous thing.
Grtz,
Rik,
Unfortunately, very few servers process cancel requests any more. It's
too easy to fake it and cancel someone else's post.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
Jerry Stuckle wrote:
Rik,
Unfortunately, very few servers process cancel requests any more.
It's
too easy to fake it and cancel someone else's post.
True, the last time I saw it it only worked on a local (restricted) server
here.
Still, it was a great source of fun to witness the confusion after
cancelled posts, where half the users missed a post the other half had
already seen. Fortunately (*ahum*) the nntp servers I use now are a little
buggy, so I'm sure to miss some posts regardless....
Grtz,
--
Rik Wasmus This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gerry Sutton |
last post by:
Hi All!
I have noticed a strange behavior when using a constant identifier to
initialize an instance list variable in a base class and then trying to
modifying the list in subclasses by using either the list.extend method or
even by having the subclass create a whole new list in the variable.
The following example illustrates the situation.
|
by: Banaticus Bart |
last post by:
I wrote an abstract base class from which I've derived a few other
classes. I'd like to create a base class array where each element is
an instance of a derived object. I can create a base class pointer
which points to an instance of a derived class, but when I pass that
base class pointer into a function, it can't access the derived
object's public functions. Although, the base class pointer does call
the appropriate virtual function...
|
by: bartek |
last post by:
Hello,
I've been pondering with this for quite some time now, and finally
decided to ask here for suggestions. I'm kind of confused, actually...
Maybe I'm thinking too much...
Brain dump follows...
I need a class to represent a variable, with an associated data type
and/or value. Though, I don't want it to be a variant type, and not a
|
by: Ben |
last post by:
Hi all,
I'm not yet good at thinking the right way in c++ so although I could
solve this problem, I'm not sure if they way I'm thinking of is the best
way to do it. I need a data type or class or something that can hold
either an int, or a float, knows which one it is holding, and will allow
me to do comparisons with instances of it without the code which asks
for the comparison having to know which one it is. So maybe I could do
it...
|
by: Drew McCormack |
last post by:
I have a C++ template class which contains a static variable whose
construction registers the class with a map. Something like this:
template <typename T>
class M {
static Registrar<M> registrar;
};
The constructor of Registrar does the registering when it is initialized.
| |
by: Graham |
last post by:
This has to do with class variables and instances variables.
Given the following:
<code>
class _class:
var = 0
#rest of the class
|
by: Vladislav Kosev |
last post by:
I have this strange problem now twice: I am writing this relatevely large web
site on 2.0 and I made a static class, which I use for url encoding and
deconding (for remapping purposes). This static class needs the session
context to encode a url (because I stored the current language there), so I
made a static field of type HttpContext, which I refresh every reqest by
assigning the current context.
Now, every now and then I get this...
|
by: Jess |
last post by:
Hello,
I was told that if I declare a static class constant like this:
class A{
static const int x = 10;
};
then the above statement is a declaration rather than a definition.
As I've *defined* "x"'s value to be 10, isn't above statement a
|
by: tshad |
last post by:
In VS 2003, I am setting up an abstract class that is setting up classes for
each datatype of VB.Net (as well as C#).
I am trying to set it up so that most of the work is done in the Abstract
Class. It seems to work pretty well. I have the actual data memory
variables stored as an object as each class will use it as a different type
of object (not sure if this is a problem).
The system can tell if the variable is a string, boolean or...
|
by: tshad |
last post by:
Using VS 2003, I am trying to take a class that I created to create new
variable types to handle nulls and track changes to standard variable types.
This is for use with database variables. This tells me if a variable has
changed, give me the original and current value, and whether the current
value and original value is/was null or not.
This one works fine but is recreating the same methods over and over for
each variable type.
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |