differenze nel campo: il testo della pagina
[p]h-source is the PHP software used to create h-node.com. 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 download the SVN version (updated daily). In order to download the SVN version you have to install [a]http://subversion.apache.org/|subversion[/a]. Then type the following command in a terminal:[/p]
[code]svn co svn://svn.savannah.nongnu.org/h-source/trunk/h-source[/code]
[p]You can also access the subversion repository using HTTP (slower)[/p]
[code]svn co http://svn.savannah.nongnu.org/svn/h-source/trunk/h-source[/code]
[h1]How h-source is built[/h1]
[p]h-source has been developed using the [a]http://www.easygiant.org|EasyGiant[/a] PHP framework. The EasyGiant PHP framework force 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 ore more View files. [/p]
[p]For example, the URL of this page is the following:[/p]
[code]
http://www.h-node.com/wiki/page/en/h-source[/code]
[p]We can split the above URL in four parts[/p]
[enum]
[*] [b]http://www.h-node.com[/b] -> the domain name[/*]
[*] [b]wiki[/b] -> the controller, that is a PHP class [/*]
[*] [b]page[/b] -> the public method of the controller called [/*]
[*] [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 h-source source code just download you will find the following file: [/p]
[code]Application/Controllers/WikiController.php[/code]
[p]that is the PHP class associated to the wiki controller above mentioned. That file have 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 has to manage the database queries, that is it has to to insert new data inside the database, update the old data, or retrieve some data. Each model is a PHP class. All the model classes are saved inside the [b]Application/Models[/b] folder.[/p]
[p]Each model manages a single database table. In this case the [b]WikiModel[/b] is used to manage the [i]wiki MySQL table[/i]. The model PHP class is [b]WikiModel.php[/b] placed inside the Application/Models folder[/p]
[p]The view files are simple PHP files that contain the HTML code that form the web page, mixed with some simple PHP instruction. 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 the 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 the view files are placed inside the folder:[/p]
[code]Application/Views/Wiki[/code]
[p]The view file that serve the content of this page is [b]Application/Views/Wiki/page.php[/b][/p]