Re: [BEGINNER] Strange problem when using external class
| From: | Monte Ohrt | Date: | Sat, 28 Apr 2001 15:52:34 +0000 |
| Subject: | Re: [BEGINNER] Strange problem when using external class | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-634@lists.php.net to get a copy of this message | ||
Luc Saint-Elie wrote:
>
> Hello,
>
> I'm trying to integrate a user authentification class (that I use in a
> classical php site and works well) in a site I'm building with Smarty 1.40b1
>
> Main file is "index.php"
> "index.php" displays the template "index.tpl" that is the main template
> "index.tpl" according to the result of a 'if ' includes the template
> "register.tpl"
>
> In register.tpl :
> [...]
> <form action="authlib/register.php" method="post">
> [..]
>
> The content of register.php is
> =================================
> <?php
> require_once('backend.php');
> require('Smarty.class.php');
>
> // template instanciation
> $template= new Smarty; >>>>>>I tried to comment out this line, the result
> is the same
> $myauthlib = new authlib;
>
> $reponse = $myauthlib->registration($username, $password, $password2,
> $name, $email, $fmail, $age, $sex, $description, $url);
>
> $template->assign($reponse,$reponse);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Is that part of your problem?
> $template->assign("op",$op);
>
> if ($reponse == 2) {
> $template->display('index.tpl?op=registerok');
> } else {
>
> $template->display('index.tpl?op=registererror&raison=reponse');
> }
> ?>
>
> ==============================
>
> Result :
> -----------
> Parse error: parse error in backend.php on line 32
>
> Fatal error: Class declarations may not be nested in Smarty.class.php on
> line 51
>
> Backend.php is the authentification Class file
>
> Line 32 is the very beginning :
> ========================
> include_once('sitelib.php');
> class authlib {
>
> var $server = DATABASE_SERVER_INTERPASNET;
> var $db_user = DATABASE_USER_INTERPASNET;
> var $db_pass = DATABASE_PASSWORD_INTERPASNET;
> var $database = DATABASE_NAME_INTERPASNET;
> var $secret = "I'm the sentence used By th mD5 HasH";
> var $webmaster = "webmaster";
>
> function register ($username, $password, $password2, $name, $email, $fmail,
> $age, $sex, $description, $url) {
> >>LINE 32>>if (!$username || !$password || !$password2 || !$name ||
> !$email || !$fmail || !$age || !$sex || !$description, || !$url) {
> return $this->error[14];
> } else {
>
> ....
> ======================================
>
> Any idea ?
>
> Luc
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/