jasonlfunk Posted July 12, 2007 Share Posted July 12, 2007 Hello, I am fairly proficient in PHP as well as understanding Object oriented programming. The tutorials that I can find with google talk about oop on a single page. The application that I am designing is very clean in with OO design but I cannot quite get it straight in my mind how the objects are retained throughout various pages. The objects are going to be created/filled with data from a database and it seems like too much overhead to reconstruct these objects for every page. From what i have picked up by browsing these forms is that it is standard practice to save objects in sessions, or serialize them or something. Is there good documentation or a tutorial somewhere that explains the concepts behind this? Link to comment https://forums.phpfreaks.com/topic/59709-solved-objects-over-multiple-pages/ Share on other sites More sharing options...
per1os Posted July 12, 2007 Share Posted July 12, 2007 http://www.phpfreaks.com/forums/index.php/topic,149316.0.html <?php include('class.def.php'); // has to be before session_Start session_start(); if (!isset($_SESSION['class_name'])) { $_SESSION['class_name'] = new class_name(); }else { $x=1; } $class &= $_SESSION['class_name']; // dunno if keeping the reference works but yea if ($x==1) echo $class->get_var('test'); $class->set_var('test', 'Testing'); $_SESSION['class_name'] = $class; ?> Unsure how savory that is, efficient or how much a toll it would take on the server. But yea I think that is what you are looking for. Link to comment https://forums.phpfreaks.com/topic/59709-solved-objects-over-multiple-pages/#findComment-296767 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.