-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f05b92
commit 94570df
Showing
3 changed files
with
105 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/** | ||
* Copyright (c) 2014 Jorge Patricio Castro Castillo MIT License. | ||
*/ | ||
include "../lib/BladeOne.php"; | ||
use eftec\bladeone\BladeOne; | ||
|
||
$views = __DIR__ . '/views'; | ||
$compiledFolder = __DIR__ . '/compiled'; | ||
$blade=new BladeOne($views,$compiledFolder,BladeOne::MODE_DEBUG); | ||
|
||
|
||
$products=[ | ||
["name"=>"cocacola","price"=>10], | ||
["name"=>"fanta","price"=>20], | ||
["name"=>"sprite","price"=>30], | ||
]; | ||
|
||
|
||
try { | ||
echo $blade->run("Test2.stack", ['products'=>$products]); | ||
} catch (Exception $e) { | ||
echo "error found ".$e->getMessage()."<br>".$e->getTraceAsString(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
---stack style:---<br> | ||
@stack("style") | ||
<br>---stack example1:---<br> | ||
@stack("example1") | ||
<br>---stack example*:---<br> | ||
@stack("example*") | ||
<br>---stack examplenotexist:---<br> | ||
@stack("examplenotexist","notfound") | ||
@push("example1") | ||
alpha | ||
@endpush | ||
@push("example1") | ||
beta | ||
@endpush | ||
@push("example1","gamma") | ||
|
||
@foreach($products as $product) | ||
<div class="blue">{{$product['name']}} ${{$product['price']}}</div> | ||
@pushonce("style") | ||
<style> | ||
.blue { | ||
background-color: blue; | ||
color:white; | ||
} | ||
</style> | ||
@endpushonce | ||
@endforeach | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters