CodeIgniter / Smarty:如何从数据库中读取{$ var}?

I use codeigniter with smarty.

I have this smarty class: https://hastebin.com/milulomido.xml

It gets the job done but it doesn't expand a smarty tag {$my_tag} into its actual value if that tag is stored in the database. In that case, it will just print {$my_tag} literally.

Example of how stuff is taken from the DB:

    /**
     * Get the selected page from the database
     * @param String $page
     * @return Array
     */
    public function getPage($page)
    {
        $this->db->select('*')->from('pages')->where('identifier', $page);
        $query = $this->db->get();

        if($query->num_rows() > 0)
        {
            $result = $query->result_array();

            return $result[0];
        }

        return null;
    }

I think I need to edit that Smarty class (first link) to fix my issue but don't know how. I have some ideas but they sound hacky (like analyse everything in $data and extract the smarty tags found, then assign them as Smarty variables, or fetch a second time the content but it is horrible and introduces bugs).