Table of Contents
Step 1 : (Default)
- Create functions shn_<output type>_<module>_<action> in main.inc for the actions
/** * * This function will output search results of missing people. * * @access public * @return void */ function shn_xml_mpr_findmp() { $result = shn_mpr_find($_REQUEST['anyname']); echo "<results>"; if($result){ foreach ($row as $result){ echo "<row>". "<name>".htmlspecialchars($row['name'])."</name>". "<status>".htmlspecialchars($row['status'])."</status>" "</row>"; } }else{ echo "<message>No Records were found.</message>"; } echo "</results>"; } /** * * This function will output missing person's images * * @access public * @return void */ function shn_image_mpr_showpic() { echo shn_mpr_show_image($_REQUEST['id']); }
How to call them
- Create the url according to following
- <sahana_url>/index.php?mod=<module>&act=<action>&stream=<output type>
e.g http://localhost/sahana-phase2/index.php?mod=mpr&act=findmp&stream=xml&anyname=foobar
If you want to download
- append variable download=true
- <sahana_url>/index.php?mod=<module>&act=<action>&stream=<output type>&download=true
e.g
http://localhost/sahana-phase2/index.php?mod=mpr&act=findmp&stream=xml&download=true&anyname=foobar
- Download with specific filename append filename=<filename you want>
- <sahana_url>/index.php?mod=<module>&act=<action>&stream=<output type>&download=true&filename=<filename you want>
e.g
http://localhost/sahana-phase2/index.php?mod=mpr&act=findmp&stream=xml&download=true&filename=missinglist.xml&anyname=foobar
Available Output Types
- XML output : stream=xml
- Image output : stream=image
- SOAP based Web Services : stream=soap
- PDF output : stream=pdf
- RSS Feeds : stream=rss
Library
- Naming Convension
inc/lib_stream_<output type>.inc
Step 2 : (Optional)
- You can create a controller that can override
- shn_<mod>_controller()