Skip to content
This repository was archived by the owner on Sep 1, 2020. It is now read-only.
This repository was archived by the owner on Sep 1, 2020. It is now read-only.

Include files from string template #81

Open

Description

@zodinyac

The following code doesn't work:

$str   = new Dwoo\Template\Str('{include(file="test.tpl")}');
echo $tpl->get($str);

$str is Str object and doesn't have correct templateFactory.

When I do

$str   = new Dwoo\Template\Str('{include(file="file:test.tpl")}');
echo $tpl->get($str);

It works when I added to File::templateFactory the following code:

if ($parentTemplate === null) {
    $parentTemplate = $core->getTemplate();
}
if (!($parentTemplate instanceof self)) { // added
    $includePath = $core->getTemplateDir(); // added
} // added
if ($parentTemplate instanceof self) {

And removed:

$class = 'Dwoo\Template\File';
if ($parentTemplate) {
    $class = get_class($parentTemplate); // removed this line
}

How I can fix this correctly? I can not use file templates from string templates.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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