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:
<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):
<?php defined('C5_EXECUTE') or die("Access Denied.");
echo $content;
?>

I get nothing.

linuxoid
 
linuxoid replied on at Permalink Reply
linuxoid
As suggested on Slack, Elements is most probably what I need. Trying to figure out how they work.

I have a my_package/elements/reviews.php with
$dh = $app->make('helper/date');
echo $test;

and its controller in my_packages/controllers/element/reviews.php with
namespace Concrete\Package\MyPackage\Controller\Element;
use Concrete\Core\Controller\ElementController;
class Reviews extends ElementController
{
    public function on_start()
    {
        $this->set('app', $this->app);
    }
    public function view()
    {
        $this->set('test', 'This is Element test');
    }
}

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?