I need to know the template of the page ID passed in because this same ajax is used from other templates, so slightly different code depending on which template we're on.
A page ID is sent over ajax, just the id, so I grab the page with `$item = $pages->get($pid);` where $pid is from the $input. All this works fine. I get the page object back. When I var_dump the object, I can see it has the template in there, i.e. "[template]=>'product'" because the ID belongs to a product the user has added to favorites.
Anyway, the problem is, I have this ID, I can get the Processwire page object, it has the template name listed in the var_dump, I can see it there, but when I try to access `$item->template()` I get this error.
"Fatal error: Exception: Method Page::template does not exist or is not callable in this context (in /home/....../wire/core/Wire.php line 519)"
Why if I have a valid ID, and grab a valid $page object, can I not access $page->template() even when I can see the data is in the object?