From 1745a73eb68c7c9a2ba4fd8bf37e57365715805a Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Mon, 25 Sep 2023 11:16:58 -0400 Subject: [PATCH] use php extension for backend views/partials files --- architecture/developer-guide.md | 18 +++++++++--------- backend/controllers-ajax.md | 8 ++++---- backend/views-partials.md | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/architecture/developer-guide.md b/architecture/developer-guide.md index 47adc250..1116e27b 100644 --- a/architecture/developer-guide.md +++ b/architecture/developer-guide.md @@ -228,13 +228,13 @@ Element classes names should use hyphen-case (dashes) Partial views should begin with an underscore character. Whereas Controller and Layout views do not begin with an underscore character. Since views are often found in a single folder, the underscore (_) and dash (-) characters can be used to organise the files. A dash is used as a substitute for a space character. An underscore is used as a substitute for a slash character (folder or namespace). ``` -index_fancy-layout.htm <== Index\Fancy layout -form-with-sidebar.htm <== Form with sidebar -_field-container.htm <== Field container (partial) -_field_baloon-selector.htm <== Field\Baloon Selector (partial) +index_fancy-layout.php <== Index\Fancy layout +form-with-sidebar.php <== Form with sidebar +_field-container.php <== Field container (partial) +_field_baloon-selector.php <== Field\Baloon Selector (partial) ``` -View files must end with the `.htm` file extension. +View files must end with the `.php` file extension. ### Class naming @@ -540,7 +540,7 @@ folder/ | |-- sub2folder/ | | `-- sub3file # A comment about this file | `-- sub2folder2/ -|-- index.htm +|-- index.php `-- .hidden_file # This file is hidden and should be slightly transparent ``` @@ -557,7 +557,7 @@ folder/ | |-- sub2folder/ | | `-- sub3file # A comment about this file | `-- sub2folder2/ -|-- index.htm +|-- index.php `-- .hidden_file # This file is hidden and should be slightly transparent ``` @@ -577,7 +577,7 @@ This feature also supports the output of the `tree` command-line utility which i # folder/ # ├── .hidden_file -# ├── index.htm +# ├── index.php # ├── subfolder1/ # ├── subfolder2/ # │ ├── document.pdf @@ -601,7 +601,7 @@ folder/ │ └── sub2folder/ │ └── sub3file ├── .hidden_file -└── index.htm +└── index.php ``` > **NOTE:** The `tree` command may print out indented lines using a character that looks to be a space character, but is not. If this is the case, you may need to add the `--charset=ascii` option to the command, which will print a diagram similar to the first example. diff --git a/backend/controllers-ajax.md b/backend/controllers-ajax.md index 9e01395f..e10a1f94 100644 --- a/backend/controllers-ajax.md +++ b/backend/controllers-ajax.md @@ -4,7 +4,7 @@ The Winter CMS backend implements the MVC pattern. Controllers manage backend pages and implement various features like forms and lists. This article describes how to develop backend controllers and how to configure controller behaviors. -Each controller consists of a PHP file which resides in the the **/controllers** subdirectory of a Plugin directory. Controller views are `.htm` files that reside in the controller view directory. The controller view directory name matches the controller class name written in lowercase. The view directory can also contain controller configuration files. An example of a controller directory structure: +Each controller consists of a PHP file which resides in the the **/controllers** subdirectory of a Plugin directory. Controller views are `.php` files that reside in the controller view directory. The controller view directory name matches the controller class name written in lowercase. The view directory can also contain controller configuration files. An example of a controller directory structure: ```treeview plugins/ @@ -12,9 +12,9 @@ plugins/ `-- blog/ |-- controllers/ | |-- users/ # Controller view directory - | | |-- _partial.htm # Controller partial file + | | |-- _partial.php # Controller partial file | | |-- config_form.yaml # Controller config file - | | `-- index.htm # Controller view file + | | `-- index.php # Controller view file | `-- Users.php # Controller class `-- Plugin.php ``` @@ -57,7 +57,7 @@ Property | Description ## Actions, views and routing -Public controller methods, called **actions** are coupled to **view files** which represent the page corresponding the action. Backend view files use PHP syntax. Example of the **index.htm** view file contents, corresponding to the **index** action method: +Public controller methods, called **actions** are coupled to **view files** which represent the page corresponding the action. Backend view files use PHP syntax. Example of the **index.php** view file contents, corresponding to the **index** action method: ```html

Hello World

diff --git a/backend/views-partials.md b/backend/views-partials.md index 9d5dfb6a..71ecd732 100644 --- a/backend/views-partials.md +++ b/backend/views-partials.md @@ -2,7 +2,7 @@ ## Partials -Backend partials are files with the extension **htm** that reside in the [controller's views](controllers-ajax#introduction) directory. The partial file names should start with the underscore: *_partial.htm*. Partials can be rendered from a backend page or another partial. Use the controller's `makePartial` method to render a partial. The method takes two parameters - the partial name and the optional array of variables to pass to the partial. Example: +Backend partials are files with the extension **php** that reside in the [controller's views](controllers-ajax#introduction) directory. The partial file names should start with the underscore: *_partial.php*. Partials can be rendered from a backend page or another partial. Use the controller's `makePartial` method to render a partial. The method takes two parameters - the partial name and the optional array of variables to pass to the partial. Example: ```php makePartial('sidebar', ['showHeader' => true]) ?> @@ -98,4 +98,4 @@ This layout uses two placeholders, a primary content area called **form-contents ``` -The layout is executed in the final section by overriding the **body** placeholder used by every backend layout. It wraps everything with a `
` HTML tag and renders the child layout called **form-with-sidebar**. This file is located in `modules\backend\layouts\form-with-sidebar.htm`. +The layout is executed in the final section by overriding the **body** placeholder used by every backend layout. It wraps everything with a `` HTML tag and renders the child layout called **form-with-sidebar**. This file is located in `modules\backend\layouts\form-with-sidebar.php`.