Skip to content

BareUI : Error when using $template->render() to include a sub-templateΒ #315

@Serge-45

Description

@Serge-45

Describe the bug

Using Leaf 4.0 / BareUI v1.2 : When including a sub-template in a template :

<?php echo $template->render('page'); ?>

I get an error

Error: Call to a member function render() on string

Expected behavior

According to doc (https://leafphp.dev/docs/frontend/bareui.html#sub-templates-partials), the $template variable should be available and should refer to the BareUI Engine.

Additional context

The variable $template is a string, its value is 'Leaf\BareUI' instead of the class.
Workaround, replacing $template with app()->template() is ok.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions