PHP code example of seunex17 / codeigniter4-smarty

1. Go to this page and download the library: Download seunex17/codeigniter4-smarty library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

seunex17 / codeigniter4-smarty example snippets


 
namespace App\Controllers;

use Seunex17\Codeigniter4Smarty\Template\Smartie;

class Home extends BaseController
{
   public function index() {
		
      return Smartie::view('test');
  }
}

 
namespace App\Controllers;

use Seunex17\Codeigniter4Smarty\Template\Smartie;

class Home extends BaseController
{
   public function index() {
		
      return Smartie::view('dashboard.test');
  }
}

 
namespace App\Controllers;

use Seunex17\Codeigniter4Smarty\Template\Smartie;

class Home extends BaseController
{
   public function index() {
	
      return Smartie::view('test', [
         'message' => 'smarty template engine',
         'title' => 'Showing example on how to use smarty'
      ]);
   }
}

public array $modifiers = ['base_url', 'site_url'];

public array $globalVariables = ['name', 'John Doe'];
shell
php spark smartie:publish