Ejemplo n.º 1
0
 public function testOrder()
 {
     $data = array(array('order' => 100, 'src' => 'test1'), array('order' => 200, 'src' => 'test2'), array('order' => 55, 'src' => 'test3'), array('order' => 0, 'src' => 'test5'), array('order' => 300, 'src' => 'test4'));
     $result = Assets::sort($data, 'order');
     $this->assertEquals('test4', $result[0]['src']);
     $this->assertEquals(300, $result[0]['order']);
     $this->assertEquals('test2', $result[1]['src']);
     $this->assertEquals('test1', $result[2]['src']);
     $this->assertEquals('test3', $result[3]['src']);
     $this->assertEquals('test5', $result[4]['src']);
 }
Ejemplo n.º 2
0
 * Something that is a common practice in web development is loading your CSS files in the header
 * and your javascript files in the footer. 
 * This example shows you how that is done
 */
include "bootstrap.php";
include "assets.php";
// In your controller.php
use BuboBox\Assets;
Assets::js('modules/asset/assets/script.js');
Assets::css('modules/asset/assets/style.css');
// In your view.php
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>Assets example</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width">
        <?php 
echo Assets::render(false, true);
?>
    </head>
    <body>
    	<p>Hello world!</p>
        <?php 
echo Assets::render(true, false);
?>
    </body>
</html>
Ejemplo n.º 3
0
<?php

include "bootstrap.php";
include "assets.php";
// In your controller.php
use BuboBox\Assets;
Assets::css('modules/asset/assets/style1.css');
Assets::css('modules/asset/assets/style2.css');
// In your view.php
echo Assets::render(false, true);