Benutzer:Elkuku/Proyektz/EasyCreator/Reusable code
Inhaltsverzeichnis |
[Bearbeiten] Extension Templates
These are complete extensions. The extensions are stored as in an ZIP package (e.g. Components are stored in
admin and
site directories).
There are some predefined constants, and some that will be defined upon creation of your extension. ToDo list of predefined constants
You can easily create your own extension templates from your favourite "Hello World" application. Just replace the name with a predefined constant.
[Bearbeiten] Location
[Bearbeiten] Included extensions
[Bearbeiten] Components
| Folder | Name | Description | Link |
|---|---|---|---|
| Controller / View | The most simple component | docs.joomla.org | |
| Model | A component using a model. | docs.joomla.org | |
| Table | A component using a table class. | docs.joomla.org | |
| Admin | A component with admin interface. | docs.joomla.org | |
| Pagination | A component with pagination. | docs joomla.org | |
| MooTools | The component "Pagination" with some MooTools demonstration including Accordion, Ajax, Lightbox, Sortables and Tooltips. | community.joomla.org | |
| Editor | A component with WYSIWYG editor | docs.joomla.org | |
| Package Base | The component "Pagination" provided with a special install script for packages. | ||
| Categories | A component using Joomla! categories |
[Bearbeiten] Modules
| Folder | Name | Description | Link |
|---|---|---|---|
| Backend Plain | A simple backend module | ||
| Frontend Plain | A simple fontend module | ||
| Hello World 2 | A MVC frontend module | docs.joomla.org |
[Bearbeiten] Plugins
| Folder | Name | Description | Link |
|---|---|---|---|
| Content 1 | A content plugin for replacing some tags. | ||
| Custom Folder | A plugin inside a custom folder. | ||
| Example Authentication | The authentication example taken from Joomla! core. | ||
| Example Content | The content example taken from Joomla! core. | ||
| Example System | Empty system plugin. | docs.joomla.org | |
| Example User | The user example taken from Joomla! core. |
[Bearbeiten] Templates
[Bearbeiten] Layout
[Bearbeiten] description.ini
A simple ini style text file containing name, description and credits.
# @version $Id: description.ini 789 2009-01-26 15:56:03Z elkuku $ # Description # <SOME TEXT> NAME=<COMPONENT NAME> DESCRIPTION=<COMPONENT DESCRIPTION> AUTHOR=<AUTHOR> DESCRIPTIONLINK=http://<LINK>
[Bearbeiten] starter.ini
A simple ini style text file containing information on how to "start up" the project.
# @version $Id: starter.ini 842 2009-05-11 22:15:16Z elkuku $ # startup structure # <COMPONENT NAME> #--The type and scope (frontend/backend) # COMTYPE=<component, module, plugin...> # # #--Files section # FILE=<DESTINATION> <SOURCE> # #--XML configuration file # INSTALLXML=<PATH> # # --Queries section # QUERY=<SQL QUERY TO BE EXECUTED> # #--Building section # BUILD=<SOURCE FOLDER> <DESTINATION FOLDER IN PACKAGE>
[Bearbeiten] Templates Parts
Also called boiler plates. These are pieces of code, you can insert in your project.
The file
part.php contains a class with two functions that will be called on displaying insert options and for processing them.
[Bearbeiten] Location
[Bearbeiten] Included parts
[Bearbeiten] Models
| Folder | Name | Description |
|---|---|---|
| Data Form | Part of admin interface for managing data records. | |
| Data List | Part of admin interface for managing data records. | |
| Simple | A simple, empty model |
[Bearbeiten] Views
| Folder | Name | Description |
|---|---|---|
| Data Form | Part of admin interface for managing data records. | |
| Data List | Part of admin interface for managing data records. | |
| Simple | A simple, empty view |
[Bearbeiten] Controllers
| Folder | Name | Description |
|---|---|---|
| Data Form | Provides methods to modify data with a specific model. | |
| Simple | A simple, empty controller |
[Bearbeiten] Tables
[Bearbeiten] Various
| Folder | Name | Description |
|---|---|---|
| Changelog | A standard, empty changelog. | |
| Package Installer | Install and Uninstall routine for packages. |
[Bearbeiten] Layout
This file contains the functions that will be called on adding the part. Every custom stuff goes in here.
- class part<GROUPNAME><PARTNAME> (e.g. partControllersSimple)
- function info() Is called on building the list of templates. Provides basic information.
- function getOptions() Displays custom options for the template.
- function insert() performs the insert task containing any custom options.
class part<GROUPNAME><PARTNAME> { /** * Info about the thing * * @return object ecrTemplateInfo */ public function info() { $info = new ecrTemplateInfo(); $info->title = JText::_('My Title'); $info->description = JText::_('My description'); return $info; }//function /** * Here you define custom options that will be displayed inside the input form * @return void */ public function getOptions() { /* This will display a scope selector (Admin/Site) */ ecrHTML::drawSelectScope(); /* Draws an input box for a name field */ ecrHTML::drawSelectName(); /* Displays options for logging */ ecrHTML::drawLoggingOptions(); /* * Add your custom options * ... */ /* Array with required fields */ $requireds = array('element_name', 'element_scope', 'table_name'); /* Draws the submit button */ ecrHTML::drawSubmitParts($requireds); }//function /** * This function will be called on inserting your template */ function insert($easyProject, $options, $logger) { /* Define stuff that will be inserted in your template */ $myVar = 'Hello World'; /* Add substitutes * Define keys that will be substitutes in the code */ $easyProject->addSubstitute('MY_SUBSTITUTE', $myVar); /* Insert the part to your project and return the results */ return $easyProject->insertPart($options, $logger); }//function }//class