8.5.4: How to render (insert) custom view in page section?
Permalink
Could anyone please tell me how I can render a custom view on an existing page in a certain section?
Say I have a page with this:
How do I stick contents of a my_view.php file into that section?
I don't want a complete page render replacement, I need insertion into the section.I've got these:
Block view.php:
Block controller.php:
View my_package/blocks/my_block/test.php (in same block folder):
I get nothing.
Say I have a page with this:
<div class="my-custom-section"> </div>
How do I stick contents of a my_view.php file into that section?
I don't want a complete page render replacement, I need insertion into the section.I've got these:
Block view.php:
<div class="my-custom-section"> <?php echo $this->controller->getTestContent(); ?> </div>
Block controller.php:
public function getTestContent() { $view = new \Concrete\Core\View\View('test'); $this->set('content', 'This is a test'); return $this->render($view); }
View my_package/blocks/my_block/test.php (in same block folder):
I get nothing.
I have a my_package/elements/reviews.php with
and its controller in my_packages/controllers/element/reviews.php with
but it complains that "Call to a member function make() on null". In fact it doesn't even set the $test value. What am I doing wrong?