Some concepts are used in different languages in a different way. And although the same words are used, they do not match. This can be quite confusing. This, in my opinion, is the source of your question. I will describe three patterns used in patterns. Each template has its own specific relationship between parents and children.
1. differentiating implementations
The template template template has a strict relationship between parents and children. Children are extensions to the parent, which is usually an abstract class. Each child represents a different implementation of the parent. An example of an abstract template class is, for example, Shape. The realization of the child can be a triangle, a square and a circle. They all use some public abstract methods such as draw () and resize (), which all have the same implementation. The goal of the abstract method is to ensure that they all have a unique, characteristic implementation of this method (for this child). A base class may also have some non-abstract methods. Examples are methods like fill () and rotate (). Each child is allowed to override these methods, but this is not required if the default implementation is sufficient. Children will be able to use public / secure data and methods from the parent, see http://en.wikipedia.org/wiki/Template_method_pattern .
2. repeating composition
The template system in html files has a similar concept, but for a different purpose. The purpose of the template system in html files is to create a flexible system for inserting independent blocks. Each block is independent of any other block, so you cannot assume that they have something in common. They may have, but this is not necessary. You can compare this with the general methods of an abstract class, because in every html file you have to implement it the same way as in other files. They are independent units to provide maximum design flexibility. The same content block can be used in different template files without any problems. And they should be able to function that way. This is a composite design template. Parent-child relationships are best described as partial-whole relationships, see http://en.wikipedia.org/wiki/Composite_pattern .
3. general data, unique presentation
Inside each html fragment, the same data is used (all data of the current request and session). They have the same data, but they should not inherit anything from each other. They also have no implementation function. You may have a content block in which you display an overview of search results using a pager. Or you may have a block with a static footer. Each html template has only one header and one body. However, there may be more menus, and a particular menu may appear in different forms in different places. Therefore, you should consider Observer or MVC. The data used is part of the model. This is the same for all kinds of data during a single query. Each block represents a different representation of the model and will use the required information. No block should know the status information or data of any other block. This, in my opinion, is the reason you asked if $ _page should be global? You need this because of the general data. Not because of the html part of the file. (This is a matter of composition.) If you, however, separate the two parts of root.php and have a common data object for all the blocks, then it can work without the $ _page being global.
Output:
If the relations between parents and children in the template design template are between classes (not objects), between html fragments between blocks of html fragments and relations between the model and general data and the required data for any particular html fragment. Parent-child relations between classes are fixed, relations between whole goals between html fragments are flexible, the model’s attitude to presentation is standardized, but not fixed.
It is most effective if the data object is created only once and remains unchanged during the request. A global can do this, but a local variable in a method can also do this, like a static class variable. I would advise you to use this implementation, which is best suited for serving your application.