Home » Wiki » h-source code » History » Differences
Differences between the revision of 02:40, 3 November 2021, created by ycp, and the revision of 02:38, 3 November 2021
Notice: the text in red has been deleted from the previous revision, the text in green has been added in this revision and the text in gray has not been changed.
differences in the entry: the title
h-source code
differences in the entry: the text of the wiki page
[p]h-source is the PHP software used to create h-node.org. The h-source source code is hosted at [a]http://savannah.nongnu.org/projects/h-source/|Savannah[/a].[/p]

[p]At the moment, there is no stable releases but you can clone the git repository:[/p]

[code]git clone https://git.savannah.gnu.org/h-source.git[/code]

[p]h-node.org pulls from the h-node branch weekly. There is also a [a]https://staging.h-node.org|staging instance[/a] that tracks the development branch.[/p] branch daily.[/p]

[h1]How h-source works[/h1]

[p]h-source has been developed using the [a]http://www.easygiant.org|EasyGiant[/a] PHP framework. The EasyGiant PHP framework forces the developer to adopt the MVC (model-view-controller) paradigm. According to this paradigm each web page served is managed by a Controller, a Model and one or more View files. [/p]

[p]For example, the URL of this page is the following:[/p]

[code]
http://www.h-node.org/wiki/page/en/h-source[/code]

[p]We can split the above URL in four parts[/p]

[enum]
[*] [b]http://www.h-node.org[/b] -> the domain name[/*]
[*] [b]wiki[/b] -> the controller, that is a PHP class [/*]
[*] [b]page[/b] -> the public method of the controller used to serve this page [/*]
[*] [b]en/h-source[/b] -> the query string, a list (separated by /) of arguments passed to the [b]page[/b] public method of the [b]wiki[/b] controller[/*]
[/enum]

[p]Inside the source code of h-source you can download, you will find the following file: [/p]

[code]Application/Controllers/WikiController.php[/code]

[p]It is the PHP class associated with the wiki controller mentioned above. That file has a public method named [b]page[/b], which require two arguments (passed in the query string: en/h-source) In this way, it is easy to find the PHP file that is serving the page you have requested. This page is served by the [b]WikiController.php[/b] PHP class by means of the [b]page[/b] public method[/p]

[p]For each [b]Controller[/b] (in this case wiki -> WikiController.php) there is also a [b]Model[/b] and one or more [b]view[/b] files.[/p]

[p]The model manages database queries, inserting new data to the database, updating old data and retrieving some data. Each model is a PHP class. All model classes are saved inside the [b]Application/Models[/b] folder. Each model manages a single database table. In this case, the [b]WikiModel.php[/b] file, the model PHP class, is used to manage the [i]wiki MySQL table[/i].[/p]

[p]The view files are simple PHP files that contain the HTML code that forms the web page, mixed with some simple PHP instructions. All the logic is written inside the controller (WikiController.php) and the model (WikiModel.php).[/p]

[p]All the view files used by a controller are saved inside the folder Application/Views or Application/Views/<controller>, where <controller> is the controller name. The view files placed inside Application/Views can be used by all controllers while the view files saved inside Application/Views/<controller> can be used only by the controller named <controller>.[/p]

[p]So, in the case of the wiki (WikiController.php) controller, all view files are placed inside a folder:[/p]

[code]Application/Views/Wiki[/code]

[p]The view file that serves the content of this page is [b]Application/Views/Wiki/page.php[/b][/p]
The contents of this page are in the Public Domain. (see the CC0 page for detailed information). Anyone is free to copy, modify, publish, use, sell, or distribute the text for any purpose, commercial or non-commercial, and by any means.
h-node.org is a hardware database project. It runs the h-source PHP software, commit cdeda15, available under the GNU General Public (GPLv3) License.
JavaScript license information