HTML and CSS Reference
In-Depth Information
public function get_title( )
{
return 'Realtime Q&A';
}
/**
* Loads and outputs the view's markup
*
* @return void
*/
public function output_view( )
{
$view = new View('home');
$view->render();
}
}
As we discussed when building the abstract Controller class, the Home class extends Controller .
First—because the home page does not accept any arguments—the constructor is overridden to avoid an Exception .
Then get_title() is declared, which simply returns the name of the app for use in the <title> tag.
Finally, the output_view() method creates a new instance of the View class and calls its render() method to
output markup.
Next, let's create the home page markup and generate any necessary variables for output.
Creating the Home View
The markup for the home page will live in a file called home.inc.php , which should be created and saved in system/views/ .
Inside, add the home markup you created in Chapter 7 (the bits that need to be set by variables have been bolded):
<section>
<form id="attending" method="post"
action=" <?php echo $join_action; ?> ">
<h2>Attending?</h2>
<p>Join a room using its ID.</p>
<label>
What is the room's ID?
<input type="text" name="room_id" />
</label>
<input type="submit" value="Join This Room" />
<input type="hidden" name="nonce"
value=" <?php echo $nonce; ?> " />
</form><!--/#attending-->
<form id="presenting" method="post"
action=" <?php echo $create_action; ?> ">
<h2>Presenting?</h2>
<p>Create a room to start your Q&amp;A session.</p>
<label>
 
Search WWH ::




Custom Search