Referencing variable in calling class?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I'd like to reference the value of a variable in a class that called the
current piece of code via a require_once.

In essence, I have a 'front controller' class that builds the page to be
displayed depending on several criteria.

One issue I'm having is that when a user logs out of my application, I
destroy the cookie that indicated the user was logged in during my preRender
process, and then go onto display the 'logged out' page. Unfortunately, I
have a page element that indicates whether the user is logged in or not, and
I assume because the cookie destruction is being sent down in that page
request, when that page renders it still appears as if the user is logged
in, because the cookie still exists until after that page is rendered.

So, I thought perhaps as part of my logout routine, I could set a variable
that my 'are you logged in or out' code could check and use to override
whether or not it displays the 'login' url or the 'logout' url.

I thought that in that code I should be able to check the value of a public
variable that is in my front controller class, but it appears I can't?

So, pseudo chain of processing would be something like this:

- call index.php
- instantiate front loader class
- perform pre-render processing, if logging out, set public variable in
class to true
- call actual page to be rendered via require_once
- in page being rendered, call function from separate file that displays
'login / logout' url
- in that function test public variable in front controller class to see if
true
- if true, regardless of whether or not the cookie still 'appears' to exist,
display 'login' url because user has logged out

However, am I right in thinking that the function that displays the login /
logout url is actually unaware of the existence of the front controller
class at the point at which it is being called?

M is for Murray

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux