In Windows architectural pattern, Frames are extensions of the Window class which means that frames are also windows. Frames are binding structures that act as bridges between a parent window and another child window, more like a root window and its subwindows. They can be referred to as data house as they provide a medium for which data can be localized and channeled across different window files.
The handling of sessions is one key feature why the use of Frames may be advised. Although spoova naturally supports multiple sessions, frames help to separate sessions from each other while providing an organized structure and pattern to which each session disseminates its information.
When creating Frame files or classes, it is important to separate them from other window files and they should be in
any subdirectory of the window folder. This makes it easier to locate them.
Also, as a naming convention, Frames should be appended the name "Frame". For example a frame file with name of IndexFrame
sends a meaning that such frame belongs to the Index files or files that may exists outside a session while one with a name of
UserFrame
reveals that it contains data for a user account.
super()
method is a method that helps a window to perform operations that must run before any window handler file is executed.
This function can be useful for instantianting functions or even initializing session configurations. The key point is that super()
method should
only be declared within a frame file. In fact, it should be declared as a final method. This helps to ensure that no other child class has the ability
to overide it. Once declared, all children classes extending to such frames will ensure to execute the super method first before
running. Example of usage is shown below: <?php use Window; class SessionFrame extends Window { final static function super() { new Session('session_name', 'cookie_name'); } }
<?php
...add namespace here...
class Child extends SessionFrame {
function construct() {
self::load('template-file', fn() => compile() );
}
}
super()
as a final method. In this case, the child class may need to call the parent::super()
within its own super()
method.