Passing data to a page template.
Permalink
I'm trying to find a way to pass data to a page template. I'm use to how things work in a block, where there's a controller and you can pass data with $this->set.
But with page templates in a theme, how does one go about passing data to the page any time its viewed?
But with page templates in a theme, how does one go about passing data to the page any time its viewed?
Well what I'd like to do is have one controller loading anytime a page is loaded, and that controller pass data to the page template. Not sure how to do this yet.
And where does a page template inherit its classes from? I can use things like Config::get from a page template, but using a custom class is obviously not available. So where are page templates inheriting from, which controller is running the show?
And where does a page template inherit its classes from? I can use things like Config::get from a page template, but using a custom class is obviously not available. So where are page templates inheriting from, which controller is running the show?
There's a diagnostic/cheat I've used a few times, which involves printing (or logging) the type of $this. I can't recall the syntax off the top of my head.
From a page template::) Thanks for the trick.
I'm an object of class Concrete\Core\Page\View\PageView
I have not used it in the context you describe, but often use it to minimnise parameter arrays passed to elements.