Re: Using AUTH and some templating engine

From: Date: Tue, 20 Apr 2004 21:15:34 +0000
Subject: Re: Using AUTH and some templating engine
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-11986@lists.php.net to get a copy of this message
dont use 'echo' in loginForm() instead you could create an instance of smarty() and fetch() its result and store in in a global variable. later use that string to put the loginform where you want it in your template? News.Php.Net wrote: > 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

« previous php.pear.general (#11986) next »