1 <section id="cg_templating">
2 <title>Templating Standards</title>
4 <title>Coding Example</title>
6 The following code examples demonstrate how all coding on FusionForge is going to be done in the future. The first example shows the <quote>switchbox</quote> page (taken from <filename>www/tracker/index.php</filename>) - where the various objects are included, instantiated and checked for errors every step of the way.
9 Once the objects are instantiated, the template file can be included. In this example, the template file is detail.php (example2).
13 <term>Template page</term>
15 <programlisting><![CDATA[
18 * FusionForge Tracker Facility
20 * Portions Copyright 1999-2000 (c) The SourceForge Crew
21 * Copyright 2002-2004 (c) The FusionForge Teem
22 * http://fusionforge.org/
24 * This file is part of FusionForge. FusionForge is free software;
25 * you can redistribute it and/or modify it under the terms of the
26 * GNU General Public License as published by the Free Software
27 * Foundation; either version 2 of the Licence, or (at your option)
30 * FusionForge is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
35 * You should have received a copy of the GNU General Public License along
36 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
37 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
40 echo $ath->header(array
41 ('title'=>'Detail: '.$ah->getID(). ' '.$ah->getSummary()));
44 <H2>[#<?php echo $ah->getID(); ?>] <?php echo $ah->getSummary(); ?></H2>
46 <TABLE CELLPADDING="0" WIDTH="100%">
47 <FORM ACTION="<?php echo $PHP_SELF; ?>
48 ?group_id=<?php echo $group_id; ?>
49 &atid=<?php echo $ath->getID(); ?>" METHOD="POST">
50 <INPUT TYPE="HIDDEN" NAME="func" VALUE="monitor">
51 <INPUT TYPE="HIDDEN" NAME="artifact_id"
52 VALUE="<?php echo $ah->getID(); ?>">
56 if (!session_loggedin()) {
59 <INPUT TYPE="TEXT" NAME="user_email"
60 SIZE="20" MAXLENGTH="40">
64 <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Monitor">
71 <?php echo date( $sys_datefmt,
72 $ah->getOpenDate() ); ?></TD>
73 <TD><B>Priority:</B><BR>
74 <?php echo $ah->getPriority(); ?></TD>
78 <TD><B>Submitted By:</B><BR>
79 <?php echo $ah->getSubmittedRealName(); ?>
80 (<?php echo $ah->getSubmittedUnixName(); ?>)</TD>
81 <TD><B>Assigned To:</B><BR>
82 <?php echo $ah->getAssignedRealName(); ?>
83 (<?php echo $ah->getAssignedUnixName(); ?>)</TD>
87 <TD><B>Category:</B><BR>
88 <?php echo $ah->getCategoryName(); ?></TD>
89 <TD><B>Status:</B><BR>
90 <?php echo $ah->getStatusName(); ?></TD>
94 <H3>DO NOT enter passwords or confidential information
96 <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="SUBMIT">
104 $ath->footer(array());
106 ?>]]></programlisting>