Date: 07/08/01
- Next message: Almond Wong: "[phplib] Newbie - sample program for a master/slave entry."
- Previous message: Mike Gifford: "Re: [phplib] Using phplib to develop new applications"
- In reply to: Mike Gifford: "Re: [phplib] Using phplib to develop new applications"
- Next in thread: Mike Gifford: "Re: [phplib] Using phplib to develop new applications"
- Reply: Mike Gifford: "Re: [phplib] Using phplib to develop new applications"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, 8 Jul 2001, Mike Gifford wrote:
>
> Still a bit confused in the use of Classes. With phplib & phpSlash's own
> collection of *.class files it is used rather extensively...
>
> objects are also something I have yet to grapple with. This was
> useful though.
>
> http://www.phpbuilder.com/columns/chad19990414.php3?page=2
>
Classes and objects are the same things, only in two diffrent states. A
class is a file (or database column, or email, or remote website,
whatever, files seems like the best choice though :) containing a set
defintion of variables and executable code. It is the class file that you
include() into your running php script which that sets up the class
definition in the php parser internals. An object is simply an instance
of a specific class which has its own state.
For instance, look at the following class definition:
class Person {
var $name = 'Bob';
function setName($newName) {
global $db;
if (!empty($newName)) {
$db->query("INSERT $newName INTO tableX WHERE name='$this->name'");
$this->name = $newName;
}
}
}
This class has a class name (Person) and a property, ($name) Now we can
use this class to set the name and store it:
// Suck int he class
include('./Person.class');
// Let's make two new instances of the Person class
$person1 = new Person;
$person2 = new Person;
/***
$person1 and $person2 are both diffrent objects of the same class, but
they have their own states. The two objects are currently identical,
but the following will change their states.
***/
$person1->setName("All-Star P-Funk");
$person2->setName("NOFX");
print($person1->name); // Will Output "All-Star P-Funk"
print($person2->name); // Will Output "NOFX"
print($name); // Won't output anything
It's important to note that object properties and methods (aka: variables
and functions for objects) don't exsist in the global namespace in php,
thus, when writing a library or some other such complicated program, you
have much less pollution in your namespace. I'd advise getting to know
Object Orienatated design a little better, it will help you with any
medium or large scale project (well, little ones too, but the big ones
you'll notince it more)
> > we also use sessions and
>
>
> I've mentioned the need for i18n capacity within phpSlash (few days
> ago) and now that I have a bit of a better understanding of sessions
> it makes a lot of sense that this type of variable
> (navigation/template lagunages) would be passed along through
> sessions.
>
Sessions are just that, sessions. Once your browser goes bye-bye or your
sessions is destporyed, so is the information in it. Sessions are good
for maintaing a state, but remember to commit things like prefs to the db
as well, else your users will need to re-enter them all the time. many
sites don't do this and it pisses me off, its lazy design.
> > Ajay's new code uses Auth and Perm. I belive people are
> > using phplib for simple auth and perm as well as building apps on it (IMP
> > has bits o' phplib, as does phpGroupWare I think)
>
>
> Is Ajay's code in the phpSlash sourceforge CVS? If permissions can be
> set up using phplib I do need to ensure that the admin files aren't
> accessed without a password. Would be nice to be able to do this with
> phplib.
>
Ajay's code is in the phpslash-ft branch as SF. I'm not sure what you
mean about passwords though? You still need to authenticate yourself
to phplib with a password in order to gain permissions.
> > What do you want to do?
> > phplib is a library that makes your life easy with a few things, it isn't,
> > all by its self an app framework.
>
> It seems to be a pretty useful tool. I was going to start writing two
> apps from scratch but decided to take a look at phplib to see if there
> was some way that I could use it to make my life easier.
>
> I think that the templates certainly would. session/authorization
> would likely do so as well.
>
> I've got a contract to build a site with three key dynamic components.
> 1) articles + comments with search engine (phpSlash).
> 2) bibliography to organize some 10,000+ references (books, journals, etc.)
> 3) profile directory - name, email, url, profession, spoken languages, etc.
Use LDAP for the last one if you can, that's what it's made for. phplib
has an LDAP-based auth class. This will also let you be a directory
service like 411, Bigfoot, etc, which may be handy in your case :)
>
> There also needs to be some inter-relation between the different
> applications. I'm trying to plan out the database at the moment...
>
OO desgin will help you with this, you'll be able to pull a several
classes into a script and use all their functionality. It's not quite
*that* easy (espically with phpslash) but you get my point.
> Eventually it will all need to be multi-lingual. The templates will
> help with this. Back-End is presently capable of producing a fully
> bilingual web site (thanks to the templates.inc). The implementation
> isn't as crisp as it is with phpSlash, but it does the job.
>
> I'd like to be able to pick up as many tested/effective pieces of code
> that I can to help build a solid reliable product. phplib seems to be
> a good place to start. Especially since one of the three apps will
> already be using it.
phplib has been around a long time, the code is stable and mature.
-n
-- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- nathan hruby / digital statement nathan <email protected> http://www.dstatement.com/Public GPG key can be found at: http://www.dstatement.com/nathan-gpg-key.txt ED54 9A5E 132D BD01 9103 EEF3 E1B9 4738 EC90 801B -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>
- Next message: Almond Wong: "[phplib] Newbie - sample program for a master/slave entry."
- Previous message: Mike Gifford: "Re: [phplib] Using phplib to develop new applications"
- In reply to: Mike Gifford: "Re: [phplib] Using phplib to develop new applications"
- Next in thread: Mike Gifford: "Re: [phplib] Using phplib to develop new applications"
- Reply: Mike Gifford: "Re: [phplib] Using phplib to develop new applications"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

