Introduction

Front Controller design pattern allows you to stay in a single page and include the necessary files according to your actions.

The current actions can be broadly divided into two levels

  1. Module in which you are performing operation i.e. accessed by mod=<module prefix>
  2. Action that your are performing. i.e. accessed by act=<action prefix>
example
http://localhost/sahana/index.php?mod=or&act=default

Overrides

There are mainly two types of overrides available

  1. Override that will be passed to the url e.g stream
  2. Overrides which can be included in the main.inc of the module i.e. Overriding with main.inc

Overriding with url

Overriding with main.inc

Following are the types of overrides that are available with main.inc

  1. Overriding html head (key: html_head)
  2. Overriding page header (key: header)
  3. Overriding main menu (key: mainmenu)
  4. Overriding login section (key: login)
  5. Overriding footer (key: footer)

To override any of the above sections all you need to do is create a function called shn_<module prefix>_<key mention above>

Example: Overriding HTML Head Totally
 
function shn_test_html_head()
{
?>
<html>
<head>
<title>This is very simple head without css even</title>
</head>
 
<?php
}
 
Example2: Just adding another javascript
function shn_test_html_head()
{
    global $global;
    include $global['approot']."/inc/lib_xhtml.inc";
 
    $myjavascripts = array ('<script type="text/javascript" src="index.php?stream=text&mod=test&act=say_hello" ></script>',
'<script type="text/javascript" src="index.php?stream=text&mod=test&act=say_world"></script>');
    shn_display_xhtml_head($myjavascripts);
}

Navigation
  • Navigate