xyn Posted February 8, 2007 Share Posted February 8, 2007 Hey Guys, Those of you who are formiliar with Smarty Templates (http://smarty.php.net) Could you please help me, because I'm slightly stuck... Basically i create my object and arrange everything correctly, and nothing happens Page_Test.php <?php include("Plug.class.php"); // This is one hing i haven't got... $plug = new Smarty; //Object created $plug->assign('U_NAME', 'Paul'); $plug->assign('AGE', '25'); //Display it $plug->display("form.tpl"); ?> form.tpl <html> <head> <title>User Info</title> </head> <body> User Information:<p> Name: {U_NAME}<br> Age: {AGE}<br> </body> </html> I'm confused. Quote Link to comment Share on other sites More sharing options...
steviez Posted February 8, 2007 Share Posted February 8, 2007 I might be barking up the wrong tree here but here it goes, When i used smarty last i had to replace the <?php ?> tags with {php} {/php} That makes the system understand that its PHP Let me know if it works Steve Quote Link to comment Share on other sites More sharing options...
obsidian Posted February 8, 2007 Share Posted February 8, 2007 I might be barking up the wrong tree here but here it goes, When i used smarty last i had to replace the <?php ?> tags with {php} {/php} That's only if you're including actual PHP script within the template itself. In the case of xyn, though, he's using an external tpl file, so he shouldn't have to worry with that step. @xyn - The "one thing you haven't got" seems to be your problem. You must be including the Smarty class on your page somewhere to be able to use it. Unless your Plug page you're including is actually extending the Smarty class itself, you're stuck. You have to include the Smarty class definition file, and then you can create the new Smarty object. Quote Link to comment Share on other sites More sharing options...
xyn Posted February 8, 2007 Author Share Posted February 8, 2007 @xyn - The "one thing you haven't got" seems to be your problem. You must be including the Smarty class on your page somewhere to be able to use it. Unless your Plug page you're including is actually extending the Smarty class itself, you're stuck. You have to include the Smarty class definition file, and then you can create the new Smarty object. Any ideas what this "Class definition file" is / looks like? Orhow i can create it :S (I'm very new to this Smarty Engine) Quote Link to comment Share on other sites More sharing options...
obsidian Posted February 8, 2007 Share Posted February 8, 2007 Any ideas what this "Class definition file" is / looks like? Orhow i can create it :S (I'm very new to this Smarty Engine) Umm... that's actually the core of Smarty. That's what you have to download and install. Have you gone through the tutorials or the crash course on the smarty website? That takes you through installation and setup of your first Smarty script... might be very useful at this point. Quote Link to comment Share on other sites More sharing options...
xyn Posted February 10, 2007 Author Share Posted February 10, 2007 Would I need to download PHP for this? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.