What are the potential issues with using Smarty in a separate class in PHP?

One potential issue with using Smarty in a separate class in PHP is that it can lead to a tight coupling between the Smarty template engine and the rest of your application logic, making it harder to maintain and test. To solve this, you can create a wrapper class that encapsulates the interaction with Smarty, keeping the template engine separate from the core application logic.

class SmartyWrapper {
    private $smarty;

    public function __construct() {
        $this->smarty = new Smarty();
        // configure Smarty settings here
    }

    public function assign($name, $value) {
        $this->smarty->assign($name, $value);
    }

    public function display($template) {
        $this->smarty->display($template);
    }

    // Add more methods as needed to interact with Smarty
}