feulf/raintpl

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

Opened this issue · 10 comments

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.

Sounds like a bug, have you tried to use asbolute path instead?

I'll check and fix it next week, thanks.

From my iPhone

On Oct 12, 2013, at 11:05 AM, Aaron Drake notifications@github.com wrote:

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:

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: "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. — Reply to this email directly or view it on GitHub.

absolute path works. Thanks for the work around.

Actually the absolute path works for eliminating the premature end of headers error, but the page does not render properly. The rewritten URLs are all wrong and the menu links are not rewritten properly either.

Ok I'll look into this issue

From my iPhone

On Oct 12, 2013, at 9:33 PM, Aaron Drake notifications@github.com wrote:

Actually the absolute path works for eliminating the premature end of headers error, but the page does not render properly. The rewritten URLs are all wrong and the menu links are not rewritten properly either.


Reply to this email directly or view it on GitHub.

Any estimates of went to fix might be this?
thanks very much for a great piece of software even though it has this one little Issue

sorry for my poor grammar. My question was do you know when A fix might be available for this?

this error should be already fixed in RainTPL 3, could you simply move to the newest version?

I updated to the master currently in github and I still experience the issue

raintpl3 right? http://github.com/rainphp/raintpl3

On Tue, Oct 15, 2013 at 6:38 PM, Aaron Drake notifications@github.comwrote:

I updated to the master currently in github and I still experience the
issue


Reply to this email directly or view it on GitHubhttps://github.com//issues/39#issuecomment-26378832
.

yes of course, I download the ZIP and install it over my rain/library/Rain path. then I updated all my index.php to use rain/library/Rain/autoload.php