View blade
note: mục đính là tiết kiệm tối thiểu code -> giảm code, giảm thời gian , giảm chi phí . dễ bảo trì, dễ áp dụng các rule .
--> sinh ra templade . ở laravel có 1 dạng như vậy là các file [filename].blade.php
- có file nguồn -> có file kế thừa
---------------------------------------------------------------------------------
1. file nguồn
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><?php echo $title ; ?> </title>
</head>
<body bgcolor="green" >
@yield('content')
<table>
@yield('rows')
</table>
</body>
</html>
2. file kế thừa nó
@extends('blade.app')
@section('content')
@include('blade.subview',['mar_quee'=>'aaaaaaa', 'mar_quee'=>'bbbbbbbbbbb']);
<?php $x = "chào em "; ?>
{{$x or 'khong ton tai bien diem'}}
<br/>
<br/>
<b>duyệt mảng ! </b>
<?php
$array = ["com", "pho", "bun", "chao", "deo biet"];
?>
@foreach($array as $item)
<br/>
<b>
{!!$item!!}
<b/>
@endforeach
<br/>
<hr/>
@for($i=0; $i <=10; $i=$i+1)
hien thị ra là : {{$i}} ;
<br/>
@endfor
@stop
note: mục đính là tiết kiệm tối thiểu code -> giảm code, giảm thời gian , giảm chi phí . dễ bảo trì, dễ áp dụng các rule .
--> sinh ra templade . ở laravel có 1 dạng như vậy là các file [filename].blade.php
- có file nguồn -> có file kế thừa
---------------------------------------------------------------------------------
1. file nguồn
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><?php echo $title ; ?> </title>
</head>
<body bgcolor="green" >
@yield('content')
<table>
@yield('rows')
</table>
</body>
</html>
2. file kế thừa nó
@extends('blade.app')
@section('content')
@include('blade.subview',['mar_quee'=>'aaaaaaa', 'mar_quee'=>'bbbbbbbbbbb']);
<?php $x = "chào em "; ?>
{{$x or 'khong ton tai bien diem'}}
<br/>
<br/>
<b>duyệt mảng ! </b>
<?php
$array = ["com", "pho", "bun", "chao", "deo biet"];
?>
@foreach($array as $item)
<br/>
<b>
{!!$item!!}
<b/>
@endforeach
<br/>
<hr/>
@for($i=0; $i <=10; $i=$i+1)
hien thị ra là : {{$i}} ;
<br/>
@endfor
@stop
Không có nhận xét nào:
Đăng nhận xét