Using AUTH and some templating engine
| From: | news.php.net | Date: | Tue, 20 Apr 2004 06:17:20 +0000 |
| Subject: | Using AUTH and some templating engine | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-11961@lists.php.net to get a copy of this message | ||
I am writing an simple admin interface for a tabulation system. I am using PEAR Auth package to manage the authentication and Smarty for the UI templates. I have a code similar to what is illustrated below
[PHPCODE]
$params = array(
"dsn" => $dsn,
"table" => "users",
"usernamecol" => "user_id",
"passwordcol" => "user_passwd");
$a = new Auth("DB",$params,"loginForm");
$a->start();
..
..
..
if ($a->getAuth()) {
//go to some where
}
else {
$template->display("index.tpl");
}
[/PHPCODE]
Now, the I believe that the start() method of Auth (see $a->start() ) causes it to call loginForm (if not authenticated).... but when viewing the HTML output... the order of output is something like
<form login>
username: <input ..... >
password: <input ..... >
</form login>
<html>
<body>
</body>
</html>
we know that is is not the proper way to write an HTML... what I want is to be able to control the showing of login form... by saving the form's HTML and assigning it to a Smarty template variable (index.tpl) so that it will be located within the <body> </body>...
jun