|
Posted by ZeldorBlat on 05/14/07 16:00
On May 14, 11:53 am, carrion <hofmann.johan...@gmail.com> wrote:
> Hello everyone!
> I'm currently working on a MVC-framework and have run into an issue.
>
> I'm using separate script files to render the active page's CSS and
> Javascript Code.
> I want to pull the data from the page controller object, which is
> initialized in another script.
> I thought this wouldn't be a problem if I simply stored the controller
> in the session-file, but the unserialization of the object simply
> won't work.
> The controller has properties that are of different class types than
> the controller itsself (page-secific Model and View objects).
>
> My Questions:
>
> 1. Are there any problems using $myObj=$_SESSION['myObj']; ?
> I thought that as of PHP5 this should work?
Not that I know of.
>
> 2. do class definitions of contained objects also have to be known
> when i unserialize?
> (like my Model/View objects)
Yes.
>
> 3. can I get __autoload to help me out of this?
Absolutely. I highly recommend the use of __autoload() for a lot of
reasons, not the least of which is the problem you've described.
function __autoload($class_name) {
$fn = $class_name . '.php';
require_once $fn;
}
Navigation:
[Reply to this message]
|