Differences

This shows you the differences between two versions of the page.

dev:frontcontroller [2006/08/10 05:30]
editor
dev:frontcontroller [2009/07/06 20:36] (current)
Line 1: Line 1:
 +====== 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
 +  - Module in which you are performing operation i.e. accessed by mod=<module prefix>
 +  - 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
 +  - Override that will be passed to the url e.g [[dev:stream]]
 +  - Overrides which can be included in the main.inc of the module i.e. Overriding with main.inc
 +
 +==== Overriding with url ====
 +  * Please refer [[dev:stream]]
 +
 +==== Overriding with main.inc ====
 +Following are the types of overrides that are available with main.inc
 +  - Overriding html head (key: html_head)
 +  - Overriding page header (key: header)
 +  - Overriding main menu (key: mainmenu)
 +  - Overriding login section (key: login)
 +  - 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>
 +
 +<code php>
 +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);
 +}
 +</code>

Navigation
  • Navigate