PHP code example of rnr1721 / le7-view

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

    

rnr1721 / le7-view example snippets


        $styles = [
            'bootstrap5' => 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css'
        ];

        $scripts = [
            'axios' => [
                // You can define with params as need
                'script' => 'https://cdnjs.cloudflare.com/ajax/libs/axios/1.4.0/axios.min.js',
                'params' => 'defer'
            ],
            // Or you can define scripts directly
            'jquery' => 'https://code.jquery.com/jquery-3.7.0.min.js',
            'vuejs' => 'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js',
            'bootstrap5' => 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js'
        ];

        $collections = [
            'mycollection' => [
                'scripts_header' => [
                    'vuejs'
                ],
                'scripts_footer' => [
                    
                ],
                'styles' => [
                    'bootstrap5'
                ]
            ]
        ];

use Core\View\AssetsCollectionGeneric;
$ac = new AssetsCollectionGeneric($scripts, $styles, $collections);

$ac->setStyle('bootstrap5', 'https://link_to_bootstrap5.css');

$params = 'defer' // Not-p5', 'https://link_to_bootstrap5.js', $params);

// Add to header
$ac->setCollection('mycollection', ['vuejs'], [], ['bootstrap5']);
// Add to footer
$ac->setCollection('mycollection', [], ['vuejs'], ['bootstrap5']);