I'm newbie in laravel 4.0.
lang/en/texts.php
?Lang::getAll()
method?My goal is to generate keywords/description in my base controller, to fill them into the the meta tags and other places in the DOM in the master blade template. If my approach is completely wrong, please tell me!
Generating the keywords and description from an associative array is NOT the problem, but the lack of knowledge about the framework. And, I was googling for quite a time before ending up here...
Working with blade templates: This is my BaseController:
class HomeController extends BaseController {
protected $layout = 'layouts.master';
private $keyWords = array();
private function getKeyWords () {
// ???
}
public function getIndex() {
return View::make('home')
->with('errorcanvas', trans('texts.canvas'))
->with('errortextwebgl', trans('texts.webgl'))
...;
}
...
}
I found something in the API:
Illuminate\Translation\FileLoader load()
which loads the messages with a given locale
...
You can get the entire array with Lang::get()
.
$array = Lang::get('pagination'); // return entire array
$text = Lang::get('pagination.next'); // return single item