PHP code example of jsnlib / joomla_template_chrome

1. Go to this page and download the library: Download jsnlib/joomla_template_chrome 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/ */

    

jsnlib / joomla_template_chrome example snippets




use \Jsnlib\Joomla\Template\Chrome;

// 設定區塊的路徑
Chrome::dir(__DIR__); 

function modChrome_lalaland($module, &$params, &$attribs)
{
    // 讓 Chrome 自動讀取 templates/mynewtemplate/html/style/lalaland.html
    // 帶入外部變數 $module
    Chrome::render('lalaland.html', function () use ($module)
    {
        // 在這裡可以做任何參數的處理,最後回傳參數提供渲染
        return ['module' => $module];
    });
}

<article>
    <header>
        <h1>{{ module.title }}</h1>
    </header>
    {{ module.content | raw }}
</article>