TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-27-2010, 04:08 PM   #1 (permalink)
The Visitor
Newcomer 
 
Join Date: Sep 2010
Posts: 1
Thanks: 0
thepriebe is on a distinguished road
Default Passing classes among PHP pages

Hello,

I'm trying to make a website using OOP with classes. Aside from passing a class using the $_GET and $_POST, how do I use an instance of a class on more than the in which the class is instantiated?

For instance, I have a class in organization.php, I create an instance of it in class.php, but I want to use variables set in class.php in test.php.

Suggestions?
thepriebe is offline  
Reply With Quote
Old 09-27-2010, 06:14 PM   #2 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Default

you could make it a singleton class or serialize it in class.php and save it in a file and then in test.php retrieve the file contents and unserialize it. But some class serialization sometimes dont keep the content of properties of a class if the property value is an instance, resource, or reference.
tony is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Support for CSS classes in PHP highlight Kalle Script Giveaway 0 04-07-2009 09:51 AM
Are there any free php classes with instructors midnightrose General 4 11-21-2008 05:34 AM
PHP5 Classes A to Z Part 1 quantumkangaroo Advanced PHP Programming 11 04-01-2008 04:21 AM
Display pages php code? Aaron General 16 01-31-2008 11:29 AM


All times are GMT. The time now is 03:16 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design