PHP Classes

File: examples/views/Test/loop2.blade.php

Recommend this page to a friend!
  Classes of Jorge Castro   BladeOne   examples/views/Test/loop2.blade.php   Download  
File: examples/views/Test/loop2.blade.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: BladeOne
Standalone template engine that compiles into PHP
Author: By
Last change: 3.44.2 It used a base 1 index to compare if the value was the last one. Now, it is fixed: $loop->last returns true if it is the last value (@foreach)
Date: 4 years ago
Size: 907 bytes
 

Contents

Class file image Download
<html>
<head>
    <title>Example of Loop 2</title>
    <!-- Google Fonts -->
    <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
    <!-- CSS Reset -->
    <link rel="stylesheet" href="//cdn.rawgit.com/necolas/normalize.css/master/normalize.css">
    <!-- Milligram CSS minified -->
    <link rel="stylesheet" href="//cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css">
</head>
<body>
<h1>Example of Loops</h1>
@foreach ($users as $user)
    <hr>
    first:{{$loop->first}}<br>
    last:{{$loop->last}}<br>
    Name user:{{$user->name}}<br>
    <ul>
    @foreach ($user->posts as $post)
        <li>first:{{$loop->first}}<br>
            last:{{$loop->last}}<br>
            {{$loop->parent->index}}<br>
            {{$loop->index}}<br> {{$loop->even}}: Subject:{{$post->subject}}</li>

    @endforeach
    </ul>
@endforeach
</body>
</html>