Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

$_SESSION with Smarty instance

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
ludovic
Smarty n00b


Joined: 11 Jan 2004
Posts: 2

PostPosted: Sun Jan 11, 2004 10:06 am    Post subject: $_SESSION with Smarty instance Reply with quote

Hey,

Could you tell me please what is wrong with the simple code below ?
I press first the "Show" button, all is ok. But, after that, if I press
the "Show2" button, I get the following error :

Fatal error: Call to undefined function: smarty_function_html_select_date() in c:\Serveur\ServeurLocal\Ecole de surf\templates_c\%%-20\%%-2027038269\test.tpl.php.php on line 15

Here is my code in the test.php file :

<?
require ("Smarty.class.php");
session_start();

$action = $_POST['action'];

if (!isset($action)) {$action = "Show";}

if ($action == "Show") {
echo "Show" . "<br>";
$_SESSION["mysmarty"] = new Smarty;
$_SESSION["mysmarty"]->template_dir = 'c:/Serveur/ServeurLocal/Ecole de surf/templates';
$_SESSION["mysmarty"] ->compile_dir = 'c:/Serveur/ServeurLocal/Ecole de surf/templates_c';
$_SESSION["mysmarty"] ->display("test.tpl.php");
}

if ($action == "Show2") {
echo "Show2" . "<br>";
$_SESSION["mysmarty"]->display("test.tpl.php");
}

?>

Here is the template test.tpl.php :

<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="test.php">
<input type="submit" name="action" value="Show">
<input type="submit" name="action" value="Show2">
{html_select_date}
</form>
</body>
</html>


Thank you for your help.

LF
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sun Jan 11, 2004 10:57 am    Post subject: Reply with quote

you should not register smarty within the session, but initialize a new smarty-object on each page.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ludovic
Smarty n00b


Joined: 11 Jan 2004
Posts: 2

PostPosted: Sun Jan 11, 2004 11:21 am    Post subject: Reply with quote

Thank you for your quick reply.

LF
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP