2017 © Pedro Peláez
 

library joomla_template_chrome

讓製作模板區塊的部分,可以分離 PHP 與 HTML

image

jsnlib/joomla_template_chrome

讓製作模板區塊的部分,可以分離 PHP 與 HTML

  • Wednesday, April 25, 2018
  • by fdjkgh580
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

joomla_template_chrome

讓製作模板區塊的部分,可以分離 PHP 與 HTML,可以更容易閱讀 HTML 與邏輯。以前台為範例,假設我們自訂模板名稱叫做 mynewtemplate:, (*1)

區塊PHP

templates/mynewtemplate/html/modules.php, (*2)

require_once JPATH_BASE . '/vendor/autoload.php';

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];
    });
}

區塊HTML

templates/mynewtemplate/html/style/lalaland.html, (*3)

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

The Versions

25/04 2018

dev-master

9999999-dev

讓製作模板區塊的部分,可以分離 PHP 與 HTML

  Sources   Download

MIT

The Requires

 

template joomla chrome

25/04 2018

1.0.1

1.0.1.0

讓製作模板區塊的部分,可以分離 PHP 與 HTML

  Sources   Download

MIT

The Requires

 

template joomla chrome

25/04 2018

1.0.0

1.0.0.0

讓製作模板區塊的部分,可以分離 PHP 與 HTML

  Sources   Download

MIT

The Requires

 

template joomla chrome