Our first View
From Rhypedigital
Our first view will simply display a message. It knows about the skeleton previously created and knows it has a placeholder called 'message'.
Here is the code frmo our first View:
<?php # # File : Lib/View/Message.php # Copyright: 2009 # : Rhype Digital Ltd # License : This file is released under the terms of the Rhype Digital Software Licence. # : Use of this software is prohibited without express permission of Rhype # : Digital Ltd. # EMail : copyright@rhypedigital.com # require_once ('RiPHPLib/MVC/View.php' ) ; require_once ('RiPHPLib/Controls/Constant.php') ; class Lib_View_Message extends RPL_MVC_View { function __construct ($message) { # Parent constructor is passed the path to the skeleton file. # parent::__construct ('Skeleton/View/Message.skel') ; # Create a RPL_Controls_Constant constant control to display the message. This # is loaded with the message and passed to the view to be used then the skeleton # is rendered. # $ctrl = new RPL_Controls_Constant (null, 'message', array('constant' => $message)) ; $this->addControl ($ctrl) ; } } ?>
The view is a type of MVC_View object which simply means it's a view.
It tells itself which skeleton to use and then creates a constant control in order to pass the value to the skeleton. It thens adds the control into itself.
