Anahkiasen / flatten

A package to flatten any website to plain HTML
336 stars 42 forks source link

Pass view arguments to the internal function of cache section. #29

Closed Namek closed 9 years ago

Namek commented 9 years ago

For such case in Laravel when we create view with arguments, such us:

View::make('layouts.index')->with('categories', $categories)

have defined layouts/index.blade.php like this:

<html><body>
    <h1>My page title</h1>
    @include('partials.menu')
    <section id="page-content> ... </section>
</body></html>

and want to use $categories in menu partial:

@cache('menu', 10)
<ul>
@foreach ($categories as $category)
    <li>{{ $category['name'] }}</li>
@endforeach
</ul>
@endcache

the index view didn't pass it's arguments to the menu partial so the commit fixes it. Not sure if it's the best way but it sure works for me.

Anahkiasen commented 9 years ago

Can you send this to develop and rebase against it?