Frage

I'm building a multi-lingual site in Laravel 3 and was trying to use the HTML helper for creating definition lists. This works by using key/value pairs to represent the dt and dd respectively.

Example

echo HTML::dl(array('Ubuntu' => 'An operating system by Canonical', 'Windows' => 'An operating system by Microsoft'));

Each of my dt elements needs to contain a translated string. But if I try to create my array like this:

array(__('core.dt_title') => $dd_value);

I get an illegal offset error.

Anyone know a way around this issue?

War es hilfreich?

Lösung

As Rubens mentioned, the __ helper is returning a Lang object and not a string. To fix your problem, simply replace __('core.dt_title') with __('core.dt_title')->get()

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top