Phalcon PhP - set view dynamically -
this question has answer here:
i'm working on website phalcon php , set view (.volt file) dynamically, based on url.
currently, can url , url matches name of .volt file. problem can content of .volt file layout seems blank because page renders without style. stylesheets include in layout.
here code of action:
public function indexaction($url){ $this->view->setlayout( 'website' ); $this->view->pick('program/'.$url); }
the url comes right, render .volt content layout seems blank.
currently similar in session , layout works:
$html = $this->view->getrender('page', $url, array('page_title' => $page_title, 'page_css_class' => $page_css_class) ); die($html);
but feature, want different because have set bunch of other stuff dynamically, such $this->assets->addjs('x.js');
etc...
can see i'm doing wrong?
thanks
just make "pick" parameter array:
$this->view->pick(['program/'.$url]);
thats it. remove set layout function, u dont need (if website default layout). not showed in documentation in best way, can check githube zaphir code details here.
good luck :)
Comments
Post a Comment