PHP code example of mvccore / ext-view-helper-assets
1. Go to this page and download the library: Download mvccore/ext-view-helper-assets 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/ */
mvccore / ext-view-helper-assets example snippets
namespace App\Controllers;
class Base {
public function PreDispatch () {
parent::PreDispatch();
\MvcCore\Ext\Views\Helpers\Assets::SetGlobalOptions([
cssMinify => TRUE,
cssJoin => TRUE,
]);
$this->Css('head')
->AppendRendered('/app/root/rel/path/to/first.css')
->Append('/app/root/rel/path/to/second.css');
}
}
html
<html>
<head>
<!--
only one file will be generated and delivered:
<link rel="stylesheet" href="/Var/Tmp/temp-file-name.css" />
-->
echo $this->Css('head')->Render();
echo $this->AssetUrl('favicon.ico');