mardi 23 février 2016

Using Structured Page Fragments and Laravel, How do I handle views?

I want to use structured page fragments in this project that I'm working on. I am developing in the Laravel 5.1 framework.

I'm still very new to SPF, but I seem to have a grasp of it at a basic level, but I'm not sure to handle my views.

When I return content to a view, should I just form an array in my controller containing all of my data, and just return that array as such:

        $obj = [
        'title' => 'Title',
        'head' => '<style>CSS Text</style>',
        'body' => ['something' => "HTML Text..."],
        'foot' => '<h1>Footer</h1>'
    ];
return $obj;

Rather than returning a view? Or is there some way to store the data in a blade file, and return that? Do I just disregard views entirely when it comes to returning fragments? Can page fragments not be stored in view files?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire