|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
ludovic Smarty n00b
Joined: 11 Jan 2004 Posts: 2
|
Posted: Sun Jan 11, 2004 10:06 am Post subject: $_SESSION with Smarty instance |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sun Jan 11, 2004 10:57 am Post subject: |
|
|
you should not register smarty within the session, but initialize a new smarty-object on each page. |
|
Back to top |
|
ludovic Smarty n00b
Joined: 11 Jan 2004 Posts: 2
|
Posted: Sun Jan 11, 2004 11:21 am Post subject: |
|
|
Thank you for your quick reply.
LF |
|
Back to top |
|
|
|
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
|