diff --git a/application/core/CMS_Controller.php b/application/core/CMS_Controller.php index d4511c48..4bcea553 100755 --- a/application/core/CMS_Controller.php +++ b/application/core/CMS_Controller.php @@ -125,12 +125,6 @@ public function __construct() } } - - if(!$this->input->is_ajax_request() && strtoupper(trim($this->cms_get_config('site_show_benchmark'))) == 'TRUE'){ - $this->output->enable_profiler(TRUE); - }else{ - $this->output->enable_profiler(FALSE); - } } public function __call($method, $args){ @@ -589,13 +583,6 @@ protected function view($view_url, $data = null, $navigation_name = null, $confi $result = null; $view_url = $this->cms_parse_keyword($view_url); - // Profiler - if(!$this->input->is_ajax_request() && strtoupper(trim($this->cms_get_config('site_show_benchmark'))) == 'TRUE'){ - $this->output->enable_profiler(TRUE); - }else{ - $this->output->enable_profiler(FALSE); - } - /* * PREPARE PARAMETERS ********************************************************************************************* */ @@ -965,7 +952,17 @@ protected function view($view_url, $data = null, $navigation_name = null, $confi if ($return_as_string) { return $result; } else { - $this->cms_show_html($result); + + // Profiler + if(!$this->input->is_ajax_request() && strtoupper(trim($this->cms_get_config('site_show_benchmark'))) == 'TRUE'){ + $this->output->enable_profiler(TRUE); + }else{ + $this->output->enable_profiler(FALSE); + } + + echo $result; + // load view introduce rendering problem if profiler activated, thus I use echo for now + //$this->cms_show_html($result); } } @@ -1006,6 +1003,8 @@ private function __cms_parse_widget_theme_path($html, $theme, $layout, $navigati if (strpos($html, '{{ ') !== false && $recursive_level > 0) { $html = $this->__cms_parse_widget_theme_path($html, $theme, $layout, $navigation_name, $recursive_level); } + + $html = $this->{$this->__cms_base_model_name}->cms_unescape_template($html); } return $html; diff --git a/application/core/CMS_Model.php b/application/core/CMS_Model.php index 514ad96c..54cb2fcc 100755 --- a/application/core/CMS_Model.php +++ b/application/core/CMS_Model.php @@ -3520,6 +3520,8 @@ public function cms_parse_keyword($value) ), $value); } + $value = $this->cms_unescape_template($value); + return $value; } diff --git a/assets/nocms/images/custom_background/firewatch_150305_04.png b/assets/nocms/images/custom_background/firewatch_150305_04.png new file mode 100755 index 00000000..a92de868 Binary files /dev/null and b/assets/nocms/images/custom_background/firewatch_150305_04.png differ diff --git a/doc/tutorial.md b/doc/tutorial.md index 786de65e..e07d037d 100755 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -18,6 +18,7 @@ For mere users and everyone * [Installation](tutorial/user_installation.md) * [Update & Migration](tutorial/user_update_and_migration.md) * [Themes](tutorial/user_themes.md) +* [Layouts](tutorial/user_layout.md) * [Setting](tutorial/user_setting.md) * [User & Groups](tutorial/user_user_and_group.md) * [Navigation & Pages](tutorial/user_navigation.md) diff --git a/doc/tutorial/designer_themes.md b/doc/tutorial/designer_themes.md index 0cab5d67..7fd51997 100755 --- a/doc/tutorial/designer_themes.md +++ b/doc/tutorial/designer_themes.md @@ -4,93 +4,43 @@ Themes ====== You can change No-CMS theme by accessing `Complete Menu | CMS Management | Change Theme` or `CMS Management | Change Theme`. -To set per-page theme, you can access `Complete Menu | Page Management` and set `Default Theme` +To set per-page theme, you can access `Complete Menu | Navigation Management` and set `Default Theme` -Themes are located at `/themes/` folder. With such a structure: +Themes are located at `/themes/` folder. With this structure: ``` /themes |--- [your_theme] - |--- /assets - | |--- /default (consists of js, css, images etc) - | |--- /[other_layout] (optional) + |--- /assets (Contains your css, js, fonts, and other static files) | |--- /views - |--- /layouts - | |--- default.php (here is the main UI script) - | |--- [other_layout].php (optional) - | - |--- /partials - |--- /default - |--- /other_layout -``` -In your `default.php`, you can several variables: - -* `$template['body']` : This variable contains your page content. -* `$template['title']` : This variable contains your page title -* `$template['metadata']` : This variable contains everything including JQuery, meta keyword, and language information -* `$template['partials']['header']` : Including `/views/partials/default/header.php`. + | |--- css.php (how the css used in your theme) + | | + | |--- js.php (how the js used in your theme) + | + |--- description.txt (theme's description) + | + |--- preview.png -You can also use several tags such as: -* `{{ site_logo }}` : Your logo path -* `{{ site_slogan }}` : Slogan -* `{{ site_footer }}` : Your footer -* `{{ widget_name:top_navigation }}` : A widget contains bootstrap styled top navigation -* `{{ widget_name:left_navigation }}` : A widget contains bootstrap styled top navigation -* And many others, see [designer tag's guide](designer_tags.md) for more information +css.php +======= +Example of css.php: -Here is a very simple example of `default.php`: ```php - - - - <?php echo $template['title']; ?> - - - -

- - - - - + add_themes_css('css/bootstrap.min.css', '{{ used_theme }}'); + $asset->add_themes_css('css/style.css', '{{ used_theme }}'); + echo $asset->compile_css(); ``` -Partials -======== -For modularity sake, you might want to separate your layout into several part (e.g: header, footer, etc). Phil Sturgeon's template library (which is used in No-CMS) already support this. You can make as many partials as you need, and access it by using `$template['partials']['your_partial_name']` variable. Partial files should be located at /themes/your_theme_name/views/partials/default/. The previous example layout can be separated into several partials: - -Content of `/themes/your_theme_name/views/layouts/default.php`: - -```html - - - - <?php echo $template['title']; ?> - - - - - - - - -``` +js.php +======= +Example of js.php: -Content of `/themes/your_theme_name/views/partials/default/header.php`: - -```html -

- -``` - -Content of `/themes/your_theme_name/views/partials/default/footer.php`: - -```html - +```php + add_cms_js('bootstrap/js/bootstrap.min.js'); + $asset->add_themes_js('js/script.js', '{{ used_theme }}'); + echo $asset->compile_js(); ``` - -__PS:__ The above example is a very minimalistic example to explain the concept. Please take a look at `/themes` folder to see the real `themes` example. diff --git a/doc/tutorial/user_layout.md b/doc/tutorial/user_layout.md new file mode 100755 index 00000000..b482041d --- /dev/null +++ b/doc/tutorial/user_layout.md @@ -0,0 +1,90 @@ +Layouts +======= + +You can manage your layouts by accessing `CMS Management | Layout Management`. Layout define how your pages looked. To modify a layout you need to know some basic HTML. + +There are some special tags you can use in layouts: +* `{{ layout:title }}` This tag will be rendered and replaced by page title +* `{{ layout:metadata }}` This tag will be rendered and replaced by default metadata +* `{{ layout:js }}` This tag will be rendered and replaced by No-CMS and theme's predefined javascript (See `js.php` in your `themes/your-theme/views`) +* `{{ layout:css }}` This tag will be rendered and replaced by No-CMS and theme's predefined css (See `css.php` in your `themes/your-theme/views`) +* `{{ layout:body }}` This tag will be rendered and replaced by current page's content. You should ensure your layout contains this tag. + +Example +======= + +Here is the default layout provided by No-CMS: + +```html + + + + + {{ layout:title }} + {{ layout:metadata }} + + + {{ layout:css }} + + + + + + {{ layout:js }} + + + + + {{ widget_name:section_top_fix }} +
+
+
{{ widget_name:section_banner }}
+
+
+
{{ navigation_path }}

+
+ +
+ {{ layout:body }} +
+
+
+
+ {{ widget_name:section_right }} +
+
+
+
+
+ + + + +``` diff --git a/modules/main/assets/navigation_icon/main_layout_management.png b/modules/main/assets/navigation_icon/main_layout_management.png new file mode 100755 index 00000000..04197ef0 Binary files /dev/null and b/modules/main/assets/navigation_icon/main_layout_management.png differ diff --git a/modules/main/controllers/Manage_user.php b/modules/main/controllers/Manage_user.php index d41207b2..b6b76cc7 100755 --- a/modules/main/controllers/Manage_user.php +++ b/modules/main/controllers/Manage_user.php @@ -280,7 +280,7 @@ public function _callback_field_group_user($value, $primary_key){ $value = array(); } $query = $this->db->select('group_id, group_name') - ->from($this->cms_user_table_name()) + ->from($this->t('main_group')) ->limit(20) ->get(); $html = '
@@ -54,9 +54,6 @@
-
- />  -
@@ -85,7 +82,7 @@
- +

Preview