Hack Forums
[PHP] Template Construction Help - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183)
+---- Thread: [PHP] Template Construction Help (/showthread.php?tid=2428524)



Template Construction Help - ScarletVenus - Apr 23, 2012

Hello. I was introduced to Smarty about a month ago, and I have learned a few details on how to construct it. But even after getting help from Smarty's documentation, I still have troubles. I managed to download Smarty files from a website I found, but I don't know how to compile these files to work on my free hosting, nor my WAMP. Now im not sure if there is supposed to be an index.tpl in that sites directory because I didn't see it in the files. But everything else is there. I would appreciate it if anyone had the time to help me compile these. So far:

In my Wamp I have created the following inside my index.php file.

PHP Code

<?php 
// load Smarty library 
$base_path= dirname(__FILE__); 
require_once(
'C:/wamp/www/smarty/libs/Smarty.class.php'); 
readfile('C:/wamp/www/smarty/templates/index.tpl'); 
$smarty = new Smarty; 
$smarty->setTemplateDir('C:/wamp/www/smarty/templates');
$smarty->setCompileDir('C:/wamp/www/smarty/templates_c'); 
$smarty->setCacheDir('C:/wamp/www/smarty/cache'); 
$smarty->setConfigDir('C:/wamp/www/smarty/configs'); 

$smarty->assign('name','fish_boy!'); 
$smarty->display('index.tpl'); 

Now the free host I am using is X10hosting, and I have tried using many Cms such as ImpressCms, Tikiwiki, and MoDx, but I have failed to figure out exactly how to setup using these files. Here is the Tree of the files I downloaded.


Style [Folder]
|- 404error.tpl
|- footer.tpl
|- header.tpl
|- headermain.tpl
Images [Folder]
Javascript [Folder]
|- login.tpl
|- memberlist.tpl
|- sitenews.tpl
|- pagination.tpl
|- profile.tpl
|- register.tpl
|- test.tpl


* - Mongrel - Apr 23, 2012

I have a question, why do use smarty? How about making one for yourself? That will be easy.