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. Link to comment https://forums.phpfreaks.com/topic/37621-smarty-help/ 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 Link to comment https://forums.phpfreaks.com/topic/37621-smarty-help/#findComment-179951 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. Link to comment https://forums.phpfreaks.com/topic/37621-smarty-help/#findComment-179955 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) Link to comment https://forums.phpfreaks.com/topic/37621-smarty-help/#findComment-180109 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. Link to comment https://forums.phpfreaks.com/topic/37621-smarty-help/#findComment-180131 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? Link to comment https://forums.phpfreaks.com/topic/37621-smarty-help/#findComment-181370 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.