Introduction to MVC Programming using Agavi, part 3rd: Adding authentication and management features with Agavi 2

Source: Internet
Author: User

Use a new master template

As you can see from Figure 3, the summary view generated by adminindexaction has the same layout and appearance as the other public pages of this WASP application. This is no surprise, because all views use the same main template, which is located in the $WASP _root/app/templates/master.php. However, for aesthetic reasons or to provide a visual warning to users as they move to another area of the application, customers often require that the management view of the application have a different look and feel.

It's not hard to do with Agavi-just create a different master template, register in Agavi, and then reference the template in the Setuphtml () method of the view.

Step 1: Create a new master template

First, create a new main template in $WASP _root/app/templates/adminmaster.php, and then populate the template with the code in Listing 20.

Listing 20. Adminmaster templates

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en"
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<base href= "<?php echo $ro->getbasehref ();?>"/>
<link rel= "stylesheet" type= "Text/css" href= "/css/default.css"/>
<link rel= "stylesheet" type= "Text/css" href= "/css/admin.css"/>
<title><?php if (isset ($t [' _title '])) echo htmlspecialchars ($t [' _title ']).
' - '; echo agaviconfig::get (' Core.app_name ');?></title>
<body>
<!--begin Header-->
<div id= "Header" >
<div id= "logo" >

</div>
<div id= "Menu" >
</div>
</div>
<!--end Header-->

<!--begin Body-->
<div id= "Body" >
<?php echo $inner;?>
</div>
<!--end Body-->

<!--begin Footer-->
<div id= "Footer" >
<p>powered by <a href= "http://www.agavi.org/" &GT;AGAVI&LT;/A&GT;.
Licensed under <a href= "http://www.creativecommons.org/" >creative Commons
</a>.</p>
</div>
<!--end Footer-->
</body>

Use these additional rules in the same place above (see Listing 21) to create a new CSS file and store it as a $WASP _root/pub/css/admin.css.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.