Improving PEAR::Auth
| From: | Martin Jansen | Date: | Tue, 09 Oct 2001 11:23:10 +0000 |
| Subject: | Improving PEAR::Auth | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-2198@lists.php.net to get a copy of this message | ||
Hi,
some people approached me and told me, that they don't like the way,
to change the appearance of the login form in PEAR::Auth. What do you
think, might be the best way to do this?
I thought about passing a new, optional parameter to the constructor,
which names a user-defined function that is used to create the output
form.
<?php
function myOutput()
{
echo "lala";
}
$auth = new Auth("DB", "<dsn>", "myOutput");
?>
with something like that in the Auth class:
function drawLogin()
{
if ($this->userFunc != "") {
call_user_func($this->userFunc);
} else {
/* ugly standard form follows here */
}
}
What do you think of this approach? It will not break any BC and the
user can change the appearance of the login form without having to
extend the Auth class (which means falling back to old PHPLIB times).
If you have better ideas how to do this, please let me know.
- Martin