File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 7
7
define ('DEVELOPMENT ' , true );
8
8
9
9
/** Stores site base url */
10
- define ('PAGE_URL ' , '' );
10
+ define ('SITE_URL ' , '' );
11
11
12
12
/** Database host address */
13
13
define ('DB_HOST ' , '' );
Original file line number Diff line number Diff line change @@ -18,8 +18,11 @@ abstract class Controller
18
18
/** @var object Points to template engine class */
19
19
protected $ _template ;
20
20
21
+ /** @var bool If true, page will be displayed */
22
+ public $ renderPage ;
23
+
21
24
/** @var bool Render template without header and footer */
22
- public $ withoutHeader ;
25
+ public $ renderHeader ;
23
26
24
27
/**
25
28
* Constructor function for Controller class
@@ -33,7 +36,8 @@ function __construct($controller, $action)
33
36
{
34
37
global $ inflect ;
35
38
36
- $ this ->withoutHeader = false ;
39
+ $ this ->renderPage = true ;
40
+ $ this ->renderHeader = true ;
37
41
38
42
$ this ->_controller = ucfirst ($ controller );
39
43
$ this ->_action = $ action ;
@@ -62,6 +66,8 @@ function set($name, $value)
62
66
*/
63
67
function __destruct ()
64
68
{
65
- $ this ->_template ->render ($ this ->withoutHeader );
69
+ if ($ this ->renderPage ) {
70
+ $ this ->_template ->render ($ this ->renderHeader );
71
+ }
66
72
}
67
73
}
Original file line number Diff line number Diff line change @@ -43,14 +43,14 @@ function set($name, $value)
43
43
/**
44
44
* Renders template to user
45
45
*
46
- * @param bool $noHeader If true , header and footer won't be rendered (i.e. for Ajax calls)
46
+ * @param bool $renderHeader If false , header and footer will be omitted in rendering process
47
47
*/
48
- function render ($ noHeader = false )
48
+ function render ($ renderHeader = true )
49
49
{
50
50
extract ($ this ->_variables );
51
51
52
52
// header
53
- if ($ noHeader == false ) {
53
+ if ($ renderHeader ) {
54
54
if (file_exists (ROOT . DS . 'application ' . DS . 'views ' . DS . $ this ->_controller . DS . 'header.php ' )) {
55
55
include (ROOT . DS . 'application ' . DS . 'views ' . DS . $ this ->_controller . DS . 'header.php ' );
56
56
} else {
@@ -62,7 +62,7 @@ function render($noHeader = false)
62
62
include (ROOT . DS . 'application ' . DS . 'views ' . DS . $ this ->_controller . DS . $ this ->_action . '.php ' );
63
63
64
64
// fotter
65
- if (! $ noHeader == false ) {
65
+ if ($ renderHeader ) {
66
66
if (file_exists (ROOT . DS . 'application ' . DS . 'views ' . DS . $ this ->_controller . DS . 'footer.php ' )) {
67
67
include (ROOT . DS . 'application ' . DS . 'views ' . DS . $ this ->_controller . DS . 'footer.php ' );
68
68
} else {
You can’t perform that action at this time.
0 commit comments