-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconventions.html
86 lines (75 loc) · 2.75 KB
/
conventions.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html lang="en">
<head>
<title>Menukaarten-docs</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="assets/css/stylesheet.css" media="screen,print">
<link rel="stylesheet" href="assets/css/print.css" media="print">
<link rel="stylesheet" type="text/css" href="assets/css/shCore.css" media="screen,print">
<link rel="stylesheet" type="text/css" href="assets/css/shThemeDefault.css" media="screen,print">
<script type="text/javascript" src="assets/js/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/SyntaxHighlighter.js"></script>
<script type="text/javascript" src="assets/js/build_menu.js"></script>
</head>
<body>
<div id="header-wrapper">
<div id="header">
<h1>Documentation SexyFramework</h1>
<span>Created by Vincent Bremer & Douwe de Haan</span>
</div>
</div>
<div id="container">
<div id="menu-wrapper">
<div id="menu">
<h1>Table of contents</h1>
<ul></ul>
</div>
</div>
<div id="content-wrapper">
<div id="content">
<!-- START CONTENT -->
<h1>Conventions</h1>
<h2>Files</h2>
<p>To ensure a good working of the different framework parts it is necessary to code by some predefined conventions. All file names are lowercase, and words are separated by an underscore. For example: config.php, user_settings.php, base_model.php, form_helper.php.</p>
<h2>Models</h2>
<p>Class names are written in CamelCase and underscore, end with _Model, and are singular.
Functions are lowercase and also use an underscore.</p>
Example: <span class="bold">user_model.php</span>
<pre class="brush: php">
class User_Model extends Base_Model {
public function find_by_id($id) {
}
}
</pre>
Example: <span class="bold">category_model.php</span>
<pre class="brush: php">
class Category_Model extends Base_Model {
public function save($data, $id) {
}
}
</pre>
<h2>Controllers</h2>
<p>Class names are in CamelCase and underscrore, have to end with _Controller, and are written in plural. All functions are in lowercase and separated with an underscore, and have to start with action_.</p>
Example: <span class="bold">users_controller.php</span>
<pre class="brush: php">
class Users_Controller extends Base_Controller {
public function action_index() {
}
public function action_edit() {
}
}
</pre>
<h2>Views</h2>
<p>Views files are placed in the main views directory in a subdirectory named after the controller which uses them. All files need to be lowercase and nicely grouped together. Some examples:</p>
<pre class="brush: plain">
users/index.php
users/new.php
cms/admin/index.php
</pre>
<!-- END CONTENT -->
<script type="text/javascript" src="assets/js/SyntaxHighlighter_settings.js"></script>
</div>
</div>
</div>
</body>
</html>