Hi,
I have the following code:
use Phalcon\Mvc\Controller;
class ControllerBase extends Controller
{
public function initialize()
{
if (!isset($this->persistent->site)){
$request = new Phalcon\Http\Request;
$result = Sites::findFirst([
'columns' => 'id, name, url, theme',
'conditions' => 'url = ?1 AND active = ?2',
'bind' => [
1 => $request->getServer('HTTP_HOST'),
2 => 1,
]
]);
if($result){
$result = $result->toArray();
$this->persistent->site = $result;
}else{
echo 'Redirect to site unavailable';
}
}
}
}
In a controller I can access the theme value by:
$this->persistent->site['theme'];
But how can I access this within volt?
Thanks