Jump to content

Recommended Posts

Posted

Hm... For whatever reason the halt() method is protected and can therefore only be called from within the class or derived ones. Passing $this to the function does not work and I don't know of any solution other than using die() or exit() in this case. Or just let the function return false and halt outside in that case:

function foo() {
  if(...) return false;
  echo 'foo bar';
}

if(foo() === false) return $this->halt();

echo 'something more';

 

  • Like 1
  • 3 years later...
  • 4 weeks later...
Posted

How would I halt output of a template file using return $this->halt(); but with that code not actually appearing in the template file itself?

In short, I want to halt output of a template file at some point using the halt method described, but I want to have it be done more flexibly, meaning I want that code to exist within my ready.php for example (or just somewhere not in the template file).  What's the best way to do this?

I don't want to use exit because it has unintended consequences.

Posted

I think your question totally depends on how you have built your frontend. When using RockFrontend for example you could hook into RockFrontend::render() and then trigger the halt() before or after any portion of code has been rendered.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...