cvs: peardoc /en/package/authentication/auth-prefmanager tutorial.xml
| From: | Christophe Gesch� | Date: | Mon, 11 Jul 2005 06:18:54 +0000 |
| Subject: | cvs: peardoc /en/package/authentication/auth-prefmanager tutorial.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-6497@lists.php.net to get a copy of this message | ||
moosh Mon Jul 11 02:18:54 2005 EDT
Modified files:
/peardoc/en/package/authentication/auth-prefmanager tutorial.xml
Log:
indent
http://cvs.php.net/diff.php/peardoc/en/package/authentication/auth-prefmanager/tutorial.xml?r1=1.5&r2=1.6&ty=u
Index: peardoc/en/package/authentication/auth-prefmanager/tutorial.xml
diff -u peardoc/en/package/authentication/auth-prefmanager/tutorial.xml:1.5
peardoc/en/package/authentication/auth-prefmanager/tutorial.xml:1.6
--- peardoc/en/package/authentication/auth-prefmanager/tutorial.xml:1.5 Fri Jul 8 16:32:31 2005
+++ peardoc/en/package/authentication/auth-prefmanager/tutorial.xml Mon Jul 11 02:18:53 2005
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
<refentry id="package.authentication.auth-prefmanager.tutorial">
<refnamediv>
<refname>
@@ -13,7 +13,10 @@
Setting up the database
</title>
<para>
- The first step is to setup a database to store the values in. For this tutorial it's
assumed that you already know the basics of using the PEAR <link
linkend="package.database.db">DB</link> class.
+ The first step is to setup a database to store the values in.
+ For this tutorial it's assumed that you already know
+ the basics of using the PEAR
+ <link linkend="package.database.db">DB</link> class.
</para>
<para>
To set up the default table layout run the following SQL statement:
@@ -52,15 +55,20 @@
</example>
</refsect1>
<refsect1 id="package.authentication.auth-prefmanager.tutorial.setdefaultpref">
- <title>Setting and displaying default preferences</title>
+ <title>Setting and displaying default preferences</title>
<para>
- Now that we have a PrefManager object, we can make use of it to set some preferences.
+ Now that we have a PrefManager object,
+ we can make use of it to set some preferences.
</para>
<para>
- For this tutorial we're going to allow users to specify their country, and assume that
any user who hasn't set their country is somewhere on Earth.
+ For this tutorial we're going
+ to allow users to specify their country,
+ and assume that any user who hasn't
+ set their country is somewhere on Earth.
</para>
<para>
- First we need to set the default value, using <link
linkend="package.authentication.auth-prefmanager.auth-prefmanager.setdefaultpref">setDefaultPref</link>.
+ First we need to set the default value, using
+ <link
linkend="package.authentication.auth-prefmanager.auth-prefmanager.setdefaultpref">setDefaultPref</link>.
</para>
<example>
<title>Setting up the object</title>
@@ -74,10 +82,14 @@
</programlisting>
</example>
<para>
- Now that the default is set, we can create a (very) basic page, welcoming users with a
customised message.
+ Now that the default is set,
+ we can create a (very) basic page,
+ welcoming users with a customised message.
</para>
<para>
- Currently this message will only ever display "Welcome to the people of Earth!",
since no users have their country set.
+ Currently this message will only ever display
+ "Welcome to the people of Earth!",
+ since no users have their country set.
</para>
<example>
<title>Getting preferences</title>
@@ -95,10 +107,13 @@
Finally we need a way for people to choose which country they're in.
</para>
<para>
- This is going to be done with a simple text box, and you should obviously be a little more
careful in a real application about allowing users to set preferences for people!
+ This is going to be done with a simple text box,
+ and you should obviously be a little more careful
+ in a real application about allowing users to set preferences for people!
</para>
<para>
- The Reset Country button will delete the user's preference, and cause the default to be
displayed again.
+ The Reset Country button will delete the user's preference,
+ and cause the default to be displayed again.
</para>
<example>
<title>Getting preferences</title>
@@ -127,7 +142,8 @@
</programlisting>
</example>
<para>
- Now once a user has entered their username, and their country, whenever they login
they'll get a personalized welcome.
+ Now once a user has entered their username,
+ and their country, whenever they login they'll get a personalized welcome.
</para>
</refsect1>
<refsect1 id="package.authentication.auth-prefmanager.tutorial.source">
@@ -141,9 +157,15 @@
require_once('Auth/PrefManager.php');
// Create the PrefManager object.
-$dsn = 'mysql://user:password@localhost/database'; // Change the DSN to fit your
database.
-$options = array('serialize' => true); // Enable serialization of data
before saving, this ensures that the values are retrieved cleanly.
-$prefmanager = new Auth_PrefManager($dsn, $options); // Create the object.
+
+// Change the DSN to fit your database.
+$dsn = 'mysql://user:password@localhost/database';
+
+// Enable serialization of data before saving, this ensures that the values are retrieved cleanly.
+$options = array('serialize' => true);
+
+// Create the object.
+$prefmanager = new Auth_PrefManager($dsn, $options);
// Set the default value (this doesn't need to be done everytime the script is run).
$prefmanager->setDefaultPref("country", "Earth");