feulf / raintpl3

The easiest Template Engine for PHP
https://feulf.github.io/raintpl
258 stars 57 forks source link

{loop=$array} = blank page? #150

Closed InteliClic closed 10 years ago

InteliClic commented 10 years ago

Hello All,

Having a problem with any RainTPL template that has {loop=$array} in the template content. I have even tried explicitly setting the loop array before I assign the variable to ensure there is at least one item but that didn't work either.

Any ideas? Certainly seems like a server problem as it works fine on other servers? Is there a setting that could prevent the system from doing a loop?

Thanks in advance!

feulf commented 10 years ago

{loop="$array"}

From my iPhone

On May 6, 2014, at 7:58 PM, "Nicholas A." notifications@github.com wrote:

Hello All,

Having a problem with any RainTPL template that has {loop=$array} in the template content. I have even tried explicitly setting the loop array before I assign the variable to ensure there is at least one item but that didn't work either.

Any ideas? Is this a server problem? Is there a setting that could prevent the system from doing a loop?

Thanks in advance!

— Reply to this email directly or view it on GitHub.

InteliClic commented 10 years ago

Yes, sorry I should have posted a snippet of my code but it is as you say with the quotes. I have pretty much figured out that it's the require in the draw function.

I have the following coded in the draw function:

    $parsedTemplateFilepath = $this->checkTemplate($templateFilePath);
    var_dump($parsedTemplateFilepath);
    var_dump(file_exists($parsedTemplateFilepath));

    ob_start();

    require $parsedTemplateFilepath;

    $html = ob_get_clean();

    var_dump($html); exit();

The print out I get from that is:

string(53) "cache/index.f07e1fcc53eb940710cc22cba4dcb3dc.rtpl.php" bool(true)

As you can see it doesn't print out the $html. If I go to the dashboard which doesn't have any loops, it prints the $html out correctly.

The problem is server specific because the same code on 2 other servers is running fine. Anything you can think of in PHP that could be disabled that would not allow the loops to run?

feulf commented 10 years ago

Check the permission on the cache folder

From my iPhone

On May 6, 2014, at 9:50 PM, "Nicholas A." notifications@github.com wrote:

Yes, sorry I should have posted a snippet of my code but it is as you say with the quotes. I have pretty much figured out that it's the require in the draw function.

I have the following coded in the draw function:

[code] $parsedTemplateFilepath = $this->checkTemplate($templateFilePath); var_dump(file_exists($parsedTemplateFilepath));

ob_start();

require("$parsedTemplateFilepath");

$html = ob_get_clean();

var_dump($html); exit();

[/code]

The print out I get from that is:

string(53) "cache/index.f07e1fcc53eb940710cc22cba4dcb3dc.rtpl.php" bool(true)

As you can see it doesn't print out the $html. If I go to the dashboard which doesn't have any loops, it prints the $html out correctly.

The problem is server specific because the same code on 2 other servers is running fine. Anything you can think of in PHP that could be disabled that would not allow the loops to run?

— Reply to this email directly or view it on GitHub.

InteliClic commented 10 years ago

The permissions are set to 777 and there are files inside that have been created by RainTPL. The files are owned by apache. The server is running on RedHat Enterprise.

feulf commented 10 years ago

The PHP version is the same for all servers?

On Wed, May 7, 2014 at 12:48 AM, Nicholas A. notifications@github.comwrote:

The permissions are set to 777 and there are files inside that have been created by RainTPL. The files are owned by apache. The server is RedHat Enterprise.

— Reply to this email directly or view it on GitHubhttps://github.com/rainphp/raintpl3/issues/150#issuecomment-42389212 .

InteliClic commented 10 years ago

Thanks again for your continued support!

The PHP version is not the same. The server in question is PHP 5.3.3 on REHL. We were also having some other configuration related problems on that server so we just moved to AWS. PHP 5.5 on REHL running great! It's something with the way that server was setup without a doubt because it was super weird, been working fine on other servers.

feulf commented 10 years ago

So you fix it?

On Thu, May 8, 2014 at 12:50 PM, Nicholas A. notifications@github.comwrote:

Thanks again for your continued support!

The PHP version is not the same. The server in question is PHP 5.3.3 on REHL. We were also having some other configuration related problems on that server so we just moved to AWS. PHP 5.5 on REHL running great! It's something with the way that server was setup without a doubt because it was super weird, been working fine on other servers.

— Reply to this email directly or view it on GitHubhttps://github.com/rainphp/raintpl3/issues/150#issuecomment-42574487 .

InteliClic commented 10 years ago

I wouldn't call that fixing it, as we never actually fixed the problem. But we avoided the problem by moving to another server and the system is fully functional now. RainTPL is working exactly as desired.