Skip to content

Relative paths defined in Tpl::configure fail on Tpl::draw #39

@drakar

Description

@drakar

The error is "premature end of script headers".

The directory structure is this

/index.php
/rain/templates/main_templates <-- my templates live here
/rain/library/Rain/...
/performance/index.php

/index.php contains:

<?php
// namespace
use Rain\Tpl;

// include
include "rain/library/Rain/Tpl.php";

// conf
$config = array(
        "base_url"  => null,
        "tpl_dir"   => "rain/templates/main/",
        "cache_dir" => "rain/cache/",
        "debug"         => false // set to false to improve the speed
);

Tpl::configure( $config );

// draw
$tpl = new Tpl;
$tpl->assign( $vars );
echo $tpl->draw( "index" );

/performance/index.php contains:

<?php

// namespace
use Rain\Tpl;

// include
include "../rain/library/Rain/Tpl.php";

// conf
$config = array(
        "base_url"  => "https://my.url",
        "tpl_dir"   => "../rain/templates/main/",
        "cache_dir" => "../rain/cache/",
        "debug"         => true // set to false to improve the speed
);

Tpl::configure( $config );

// draw
$tpl = new Tpl;
$tpl->assign( $vars );
print_r($vars);
echo $tpl->draw( "performance" );

index.php works just fine. performance/index.php fails every time. In fact the point where it fails is on the draw method. Because if I comment out draw all the $vars will print properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions