Good day to all forum users!

I’ve got an acute question: I’m told to use Smarty and design a news site on it. Considering that I didn’t come up with template engines before, it became a definite problem for me. First, I downloaded the latest version 3.1.19 from the official Smarty.net website. Unpacked it. Opened articles dedicated to installing and working with this template engine. As a result, I read that the structure should be like this:

Smarty-ver/ libs/ Smarty.class.php Smarty_Compiler.class.php Config_File.class.php debug.tpl internals/*.php (все файлы) plugins/*.php (все файлы) 

In my case, the folder and file structure does not look quite like this:

 demo/ libs/ Smarty.class.php SmartyBC.class.php debug.tpl plugins/ *.php (все файлы) sysplugins/ *.php (все файлы) 

It is not clear how to install the template on this template engine and where to get the missing files. The second request to the formumchanes: if someone worked with Smarty, you can share interesting thoughts on this subject, articles and sources. Because I was given literally two days for all this business. It is necessary to have time to quickly enter this all and design a news site on this template engine.

    1 answer 1

    The template engine connects to the executable file:


     <?php require_once SITE_DIR."libs/smarty/Smarty.class.php"; class Smarty_ extends Smarty { function Smarty_(){ // Конструктор класса. // Он автоматически вызывается при создании нового экземпляра. $this->Smarty(); $this->template_dir = SITE_DIR."tpl/"; $this->compile_dir = SITE_DIR."smarty/compile/"; $this->config_dir = SITE_DIR."smarty/configs/"; $this->cache_dir = SITE_DIR."smarty/cache/"; $this->caching = false; } } $smarty = new Smarty_; // $smarty->assign("sitename","Smarty site"); $smarty->display("index.tpl"); ?> 

    In the tpl / index.tpl file, you can specify the variable {$ sitename}, which will take the value of 'Smarty site'.

    ps Smarty is good, but two days is not enough for him.