Smarty

liunx

Guest
Im trying to use smarty but im having trouble with it.<br />if anyone can help me out.<br /><br /> i uploaded the smarty folder downloaded on smarty.php.net in the root level.<br /><br />in my php file i set following path: require('/home/MY_USER_NAME/smarty/libs/Smarty.class.php');<br /><br />then i have the following code:<br /><br />$smarty = new Smarty();<br /><br />$filepath = MY_USER_NAME;<br /><br />$smarty->template_dir = '/home/' . $filepath . '/public_html/templates';<br />$smarty->compile_dir = '/home/' . $filepath . '/public_html/templates_c';<br />$smarty->cache_dir = '/home/' . $filepath . '/public_html/cache';<br />$smarty->config_dir = '/home/' . $filepath . '/public_html/configs';<br /><br />i set chmod the templates_c and cache folder to 777<br /><br />then i have this code:<br /><br />$page = 'index';<br />$section = 'index';<br /><br />$smarty->assign('smarty', $smarty); <br />$smarty->assign('page', $page);<br />$smarty->assign('section', $section);<br />$smarty->display('template.tpl');<br /><br /><br />i have a template called template.tpl inside the template forlder.<br /><br />and if i go to my site im getting the following error message: Warning: Smarty error: unable to read resource: "template.tpl" in /home/xhclznld/smarty/libs/Smarty.class.php on line 1095<br /><br />PLEASE ANY HELP WILL BE APPRECIATED<br /><br />thanks<br />jeremie<!--content-->
Welcome to the forums Jeremie <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br /><br />I'd recheck the <a href="http://smarty.php.net/quick_start.php" target="_blank">install guide</a>.<!--content-->
Hi Bruce,<br /><br /> i did. i use smarty at work everyday. already installed it several time. for some reason it wont work here. im not sure about the path im suppose to use on TCH<!--content-->
I would try changing the statements that look like this to your actual path:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$smarty->template_dir = '/home/' . $filepath . '/public_html/templates';<!--c2--></div><!--ec2--><br /><br />to<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$smarty->template_dir = '/home/yourCpanelName/public_html/templates';<!--c2--></div><!--ec2--><!--content-->
 
Back
Top