Jump to content

$page->template VS $page->template->name


PWaddict
 Share

Recommended Posts

3 hours ago, horst said:

If OutputFormatting is off, $page->template returns the object, if OutputFormatting is on, it returns only the name.

Are you sure? I'd expect it to always return the object. It's just that the object implements __toString with it's name, so it's casted to a string if needed.

@PWaddict With == it's doing the same thing, because __toString returns the name of the template, but if you'd use === they would no longer have the same result.

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

13 hours ago, LostKobrakai said:

Are you sure? I'd expect it to always return the object. It's just that the object implements __toString with it's name, so it's casted to a string if needed.

Surely you are right. My explanation lacks correctness, as I implied a string conversion, derived from the example pwaddict has given.

Thanks for chimimg in and corecct this. ?

  • Like 1
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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