Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass view arguments to the internal function of cache section #44

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Namek
Copy link

@Namek Namek commented Sep 10, 2015

(copied from #29)

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
Copy link
Owner

Looks good! Smart way to solve this. Can you add a quick test for this in the TemplatingTest class? With and without arguments passed to section

@Namek
Copy link
Author

Namek commented Sep 12, 2015

I'm not sure how would you like to look like that test, so please do it yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants