Example #1
0
 public function testAssetCollectionDump()
 {
     $this->setUpAssetConfig();
     $asset = AssetCollection::make(function ($asset) {
         $asset->where('header')->add('style', ['path' => 'public/assets/css/bootstrap/css/bootstrap.min.css']);
         $asset->where('footer')->add('script', ['path' => 'public/assets/js/cygnite/jquery/1.10.1/jquery.min.js']);
         $asset->where('sidebar')->add('link', ['path' => 'home/index', 'name' => 'Welcome to Cygnite Framework']);
         return $asset;
     });
     ob_start();
     $asset->where('header')->dump('style');
     $this->assertEquals('<link rel="stylesheet" type="text/css" title= "" href="http://localhost/cygnite/public/assets/css/bootstrap/css/bootstrap.min.css" />', trim(ob_get_contents()));
     ob_clean();
     // Cleanup
     ob_end_clean();
     // We will test script dumping
     ob_start();
     $asset->where('footer')->dump('script');
     $this->assertEquals('<script type="text/javascript" src="http://localhost/cygnite/public/assets/js/cygnite/jquery/1.10.1/jquery.min.js"></script>', trim(ob_get_contents()));
     ob_clean();
     // Cleanup
     ob_end_clean();
     ob_start();
     $asset->where('sidebar')->dump('link');
     $this->assertEquals('<a href="http://localhost/cygnite/home/index" >Welcome to Cygnite Framework</a>', trim(ob_get_contents()));
     ob_clean();
     // Cleanup
     ob_end_clean();
 }
Example #2
0
<?php

use Cygnite\AssetManager\Asset;
use Cygnite\AssetManager\AssetCollection;
use Cygnite\Foundation\Application;
use Cygnite\Common\UrlManager\Url;
$asset = AssetCollection::make(function ($asset) {
    $asset->add('style', array('path' => 'assets/twitter/bootstrap/css/bootstrap-theme.min.css'))->add('style', array('path' => 'assets/twitter/bootstrap/css/bootstrap.min.css', 'media' => '', 'title' => ''))->add('style', array('path' => 'assets/css/cygnite/table.css'))->add('style', array('path' => 'assets/js/tablesorter/css/theme.default.css'))->add('style', array('path' => 'assets/css/cygnite/style.css'))->add('script', array('path' => 'assets/js/cygnite/jquery.js'))->add('script', array('path' => 'assets/js/custom.js'))->add('script', array('path' => 'assets/twitter/bootstrap/js/bootstrap.js'))->add('script', array('path' => 'assets/js/tablesorter/js/jquery.tablesorter.min.js'));
    return $asset;
});
?>
<!DOCTYPE html>
<html>
<head>
    <title><?php 
echo $this->title;
?>
</title>
    <?php 
$asset->dump('style');
// Style block
?>
</head>
<body>

<div class='container'>
    <?php 
echo $yield;
//your content block
?>
</div>
<?php

use Cygnite\Mvc\View\Widget;
use Cygnite\AssetManager\Asset;
use Cygnite\Common\UrlManager\Url;
use Cygnite\Foundation\Application;
use Cygnite\AssetManager\AssetCollection;
$asset = AssetCollection::make(function ($asset) {
    // group of stylesheets
    $asset->add('style', array('path' => 'assets/css/bootstrap/css/bootstrap.min.css'))->add('style', array('path' => 'assets/css/bootstrap/css/bootstrap-theme.min.css'))->add('style', array('path' => 'assets/css/cygnite/bootstrap/datatables-bootstrap.css'))->add('style', array('path' => 'assets/css/cygnite/flash.css'))->add('style', array('path' => 'assets/css/cygnite/wysihtml5/prettify.css'))->add('style', array('path' => 'assets/css/cygnite/wysihtml5/bootstrap-wysihtml5.css'));
    // Group of scripts
    $asset->add('script', array('path' => 'assets/js/cygnite/jquery/1.10.1/jquery.min.js'))->add('script', array('path' => 'assets/js/twitter/bootstrap/js/bootstrap.min.js'))->add('script', array('path' => 'assets/js/dataTables/jquery.dataTables.min.js'))->add('script', array('path' => 'assets/js/dataTables/datatables-bootstrap.js'))->add('script', array('path' => 'assets/js/dataTables/datatables.fnReloadAjax.js'))->add('script', array('path' => 'assets/js/dataTables/prettify.js'));
    return $asset;
});
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="shortcut icon" href="<?php 
echo Url::getBase();
?>
assets/img/cygnite/fevicon.png" > </link>

    <title><?php 
echo $this->title;
?>
</title>
<?php

use Cygnite\Mvc\View\Widget;
use Cygnite\Common\UrlManager\Url;
use Cygnite\AssetManager\AssetCollection;
$asset = AssetCollection::make(function ($asset) {
    // Set of resources tagged to header
    $asset->where('header')->add('style', array('path' => 'public/assets/css/bootstrap/css/bootstrap.min.css'))->add('style', array('path' => 'public/assets/css/bootstrap/css/bootstrap-theme.min.css'))->add('style', array('path' => 'public/assets/css/cygnite/bootstrap/datatables-bootstrap.css'));
    // Set of resources tagged to footer
    $asset->where('footer')->add('style', array('path' => 'public/assets/css/cygnite/flash.css'))->add('style', array('path' => 'public/assets/css/cygnite/wysihtml5/prettify.css'))->add('style', array('path' => 'public/assets/css/cygnite/wysihtml5/bootstrap-wysihtml5.css'));
    // Set of resources tagged to footer
    $asset->where('footer')->add('script', array('path' => 'public/assets/js/cygnite/jquery/1.10.1/jquery.min.js'))->add('script', array('path' => 'public/assets/js/twitter/bootstrap/js/bootstrap.min.js'))->add('script', array('path' => 'public/assets/js/dataTables/jquery.dataTables.min.js'))->add('script', array('path' => 'public/assets/js/dataTables/datatables-bootstrap.js'))->add('script', array('path' => 'public/assets/js/dataTables/datatables.fnReloadAjax.js'))->add('script', array('path' => 'public/assets/js/dataTables/prettify.js'));
    return $asset;
});
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title><?php 
echo $title;
?>
</title>
    <meta name="keywords" content="CRUD Application" />
    <meta name="author" content="Cygnite Framework Bootstrap Starter Site." />
    <!-- Google will often use this as its description of your page/site. Make it good. -->
    <meta name="description" content="Cygnite CRUD Generator." />