PHP code example of fritak / nette-dynamic-loader

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

    

fritak / nette-dynamic-loader example snippets

 php
    use DynamicLoader\Loader;

    public function createComponentHeadLoader() 
    {
        $component = clone $this->context->getByType('DynamicLoader\Loader');
        $component->renderPosition = Loader::POSITION_HEAD;
        return $component;
    }
    
    public function createComponentBottomLoader() 
    {
        $component = clone $this->context->getByType('DynamicLoader\Loader');
        $component->renderPosition = Loader::POSITION_BOTT;
        return $component;
    }
 php
{control dynamicLoader}
 php
        defaultPlugins:                                 
            - 'jquery'
            - 'jquery-ui'
            - 'bootstrap'
 php
        defaultPlugins:                                 
            front:
                - 'jquery'
            backEnd: 
                - 'jquery'
                - 'jquery-ui'
                - 'bootstrap'
 php
    public function __construct() 
    {
        $this->enablePlugins = ['jquery-ui'];
        parent::__construct();
    }
 php
    public $enablePlugins = [];

    public function createComponentHeadLoader() 
    {
        $component = clone $this->context->getByType('\DynamicLoader\Loader');
        $component->renderPosition = Loader::POSITION_HEAD;
        $component->enablePlugins = $this->enablePlugins;
        $component->group = 'front';
        return $component;
    }
    
    public function createComponentBottomLoader() 
    {
        $component = clone $this->context->getByType('\DynamicLoader\Loader');
        $component->renderPosition = Loader::POSITION_BOTT;
        $component->enablePlugins = $this->enablePlugins;
        $component->group = 'front';
        return $component;
    }