PHP code example of jsnlib / joomla_template_loader

1. Go to this page and download the library: Download jsnlib/joomla_template_loader 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_loader example snippets


 
defined('_JEXEC') or die('Restricted access');


// 指定資源
$loader->setAssets(
[
    // 全域
    'global' => 
    [
        'global' => 
        [
            [$loader->site("css/template.css"), "css"],
        ]
    ],

    // 分頁
    'com_todolist' => 
    [
        'form.index' => 
        [
            [$loader->site("css/template.css"), "css"],
        ],
        'form.upload' => 
        [
            [$loader->site("javascript/global.js"), "js"],
        ],
    ],

    // 首頁
    'com_content' => 
    [
        // 網址沒有 task 的時候
        'default' => 
        [
            [$loader->site("css/template.css"), "css"],
        ],
    ],
    
]);


echo $loader->render(__DIR__ . "/views", function ($properties)
{
    // 可查看內部屬性
    print_r($properties['option']);
});

echo $loader->render(__DIR__ . "/views", function ($properties)
{
    // 可查看內部屬性
    print_r($properties['option']);

});
`
[
    'com_todolist' => 
    [
        'form.index' => 
        [
            [$loader->site("css/template.css"), "css"],
            [$loader->site("javascript/global.js"), "js"],
        ]
    ]
]