Changes between Initial Version and Version 1 of DolphinTutorialMyFirstModule


Ignore:
Timestamp:
Jan 29, 2010, 4:41:18 AM (15 years ago)
Author:
AlexT
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DolphinTutorialMyFirstModule

    v1 v1  
     1 
     2== Dolphin 7 Tutorial: My First Module == 
     3 
     4 
     5== 1. Getting Started. == 
     6  
     7In this tutorial we will create a simple Dolphin module. In the beginning, this module will show a text page only. Then, we will add an admin section for the module. At the end we will create some basic functionality, like a blog system. 
     8 
     9In this tutorial we will create a simple Dolphin module. In the beginning, this module will show a text page only. Then, we will add an admin section for the module. At the end we will create some basic functionality, like a blog system. 
     10 
     11This tutorial covers things like a simple module structure, creating user pages and admin pages, creating config values for your module, forms and adding admin menu items. 
     12 
     13The main purpose of this tutorial is to help you get started with the new Dolphin 7 modules structure and basic functionality. 
     14 
     15To proceed with this tutorial you need: 
     16 
     17    * already installed Dolphin 7, you can get the latest Dolphin version [http://www.boonex.com/dolphin/download/ here] and detailed installation instructions are [http://www.boonex.com/trac/dolphin/wiki/DetailedInstall70 here]. 
     18    * basic PHP knowlege, object oriented programming knowledge is more than welcome. You can learn about PHP [http://www.php.net/ here]. 
     19    * basic MySQL queries knowledge, you can learn about MySQL server and MySQL queries syntax [http://www.mysql.com/ here]. 
     20 
     21 
     22The things you will not get in this tutorial: 
     23 
     24    * will not teach you PHP, MySQL, Javascript, HTML, CSS 
     25    * will not teach you how to edit and upload files to the server 
     26    * will not teach you about every Dolphin feature. There are many Dolphin features which are more complex, and mentioning them here may detract you from the main purpose of this tutorial. For a complete list of Dolphin programming features and references to the documentation in the code, check [http://www.boonex.com/trac/dolphin/wiki/DolModDev here]. 
     27    * will not tech you how to create new templates. A templates creation guide is [http://www.boonex.com/trac/dolphin/wiki/DolDesign here]. 
     28    * will not teach you how to translate Dolphin to other languages. A translation manual is [http://www.boonex.com/trac/dolphin/wiki/DolLang here]. 
     29    * will not teach security aspects of writing the code. You are responsible if you are hacked through your own module. 
     30 
     31 
     32Learning Dolphin gives you many advantages: 
     33 
     34    * you will be able to make modifications to your site 
     35    * if you are writing a modification, especially as a Dolphin module, it will allow you to transfer your modification more easily between Dolphin version upgrades. 
     36    * you can make money by selling your modifications in [http://www.boonex.com/unity/extensions/home Unity Market] or offering your service for others in the same [http://www.boonex.com/unity/extensions/home Unity Market].  
     37    * it will help you to get certified - because there are strict requirements if you want to certify your mod. 
     38 
     39 
     40Let's start with the simplest thing in the beginning. 
     41 
     42 
     43==  2. Simplest module. == 
     44 
     45There is a prepared zip package with the simplest Dolphin 7 module here(TODO:bloggie.zip). Download it, unpack and upload to the '''modules/me/''' folder. Most probably there is no me folder in the modules directory, so just create it by yourself. '''Me''' is a vendor name. For the real module, you need to rename it to the real vendor name, but for now '''me''' is fine for everybody. It will be the '''bloggie''' folder in the  '''modules/me/''' directory. Bloggie is the module name. It is good practice to name the folder where module's files are located with the name of the module, it is just more clear. In the end it will be some type of blog module with the name Bloggie. 
     46 
     47Lets describe each file in the module. This is almost the minimal set of files for the module: 
     48 
     49'''bloggie/classes''' [[BR]] 
     50directory with all module classes 
     51 
     52'''bloggie/classes/MeBlggConfig.php''' [[BR]] 
     53Module config class. In most cases you don't need to modify it - it inherits system class which has all the necessary functionality to get configuration values. 
     54 
     55'''bloggie/classes/MeBlggDb.php''' [[BR]] 
     56Module database class. It is strongly recommended that you write all SQL queries in this class only, then you can call ready functions from the code. 
     57 
     58'''bloggie/classes/MeBlggModule.php''' [[BR]] 
     59Module controller class - where the main work happens. 
     60 
     61'''bloggie/classes/MeBlggTemplate.php''' [[BR]] 
     62Module template class. You don't need to change this class. All the necessary functionality is inherited from the base class. 
     63 
     64'''bloggie/install''' [[BR]] 
     65Module installation directory, where all installation files are located, like SQL files and language files. 
     66 
     67'''bloggie/install/config.php''' [[BR]] 
     68Module installation config file. We will take a closer look at this later. 
     69 
     70'''bloggie/install/info''' [[BR]] 
     71Installation information messages folder. If you need to display information messages upon module install/uninstall, you will need to place files here - also special instructions are needed to point to in the install config file to display these messages properly. 
     72 
     73'''bloggie/install/installer.php''' [[BR]] 
     74Module installer class. You can add some custom installation scripts and override default behavior. 
     75 
     76'''bloggie/install/langs''' [[BR]] 
     77Module languages must be located in this dir. The language file name must be a php file with the name of two letters of the language code. 
     78 
     79'''bloggie/install/langs/en.php''' [[BR]] 
     80Default English language file. 
     81 
     82'''bloggie/install/sql''' [[BR]] 
     83SQL script for module install and uninstall are here. 
     84 
     85'''bloggie/install/sql/install.sql''' [[BR]] 
     86Module installation SQL file. 
     87 
     88'''bloggie/install/sql/uninstall.sql''' [[BR]] 
     89Module un-installation SQL file. 
     90 
     91'''bloggie/request.php''' [[BR]] 
     92File which routes all requests to the '''MeBlggModule''' class. You don't need to change it in most cases. 
     93 
     94'''bloggie/templates''' [[BR]] 
     95Module templates directory. You need to place *.html, *.css and image files here, according to the structure below. 
     96 
     97'''bloggie/templates/base''' [[BR]] 
     98Base template folder. You don't need to create a separate folder for each template (but you can do that). Just place all files into the base folder, and regardless of the current chosen template, all template files will be taken from here. Also, all HTML template files are located in this folder. 
     99 
     100'''bloggie/templates/base/css''' [[BR]] 
     101CSS files must be located here. 
     102 
     103'''bloggie/templates/base/images''' [[BR]] 
     104Images files must be located here. 
     105 
     106'''bloggie/templates/base/images/icons''' [[BR]] 
     107Image icons must be located here. 
     108 
     109'''bloggie/templates/base/main.html''' [[BR]] 
     110Our custom template file. 
     111 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.
Fork me on GitHub