Benutzer:Elkuku/Proyektz/EasyCreator/Reusable code

Aus Joomla! Dokumentation

Wechseln zu: Navigation, Suche

Inhaltsverzeichnis

Extension Templates

These are complete extensions. The extensions are stored as in an ZIP package (e.g. Components are stored in Datei:folder_blue.png admin and Datei:folder_blue.png 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.

Location

  • Datei:folder_blue.png EasyCreator
    • Datei:folder_blue.png templates
      • Datei:folder_blue.png GROUPNAME
        • Datei:folder_blue.png TEMPLATENAME
          • Datei:folder_blue.png tmpl
            • FILES and FOLDERS...
          • Datei:file_txt.png description.ini
          • Datei:file_txt.png starter.ini

Included extensions

Components

Folder Name Description Link
Datei:folder_blue.png mvc_1 Controller / View The most simple component docs.joomla.org
Datei:folder_blue.png mvc_2 Model A component using a model. docs.joomla.org
Datei:folder_blue.png mvc_3 Table A component using a table class. docs.joomla.org
Datei:folder_blue.png mvc_4 Admin A component with admin interface. docs.joomla.org
Datei:folder_blue.png mvc_5 Pagination A component with pagination. docs joomla.org
Datei:folder_blue.png mvc_6 MooTools The component "Pagination" with some MooTools demonstration including Accordion, Ajax, Lightbox, Sortables and Tooltips. community.joomla.org
Datei:folder_blue.png mvc_7 Editor A component with WYSIWYG editor docs.joomla.org
Datei:folder_blue.png mvc_8 Package Base The component "Pagination" provided with a special install script for packages.
Datei:folder_blue.png mvc_9 Categories A component using Joomla! categories

Modules

Folder Name Description Link
Datei:folder_blue.png backend_simple Backend Plain A simple backend module
Datei:folder_blue.png frontend_simple Frontend Plain A simple fontend module
Datei:folder_blue.png hello_world_2 Hello World 2 A MVC frontend module docs.joomla.org

Plugins

Folder Name Description Link
Datei:folder_blue.png content_simple Content 1 A content plugin for replacing some tags.
Datei:folder_blue.png custom_folder Custom Folder A plugin inside a custom folder.
Datei:folder_blue.png example_auth Example Authentication The authentication example taken from Joomla! core.
Datei:folder_blue.png example_content Example Content The content example taken from Joomla! core.
Datei:folder_blue.png example_system Example System Empty system plugin. docs.joomla.org
Datei:folder_blue.png example_user Example User The user example taken from Joomla! core.

Templates

Folder Name Description Link
Datei:folder_blue.png beez_copy Copy of Beez A copy of the Beez template, taken from it's original place.
Datei:folder_blue.png rhuk_milkyway_copy Copy of Rhuk MilkyWay A copy of the Rhuk MilkyWay template, taken from it's original place.

Layout

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>

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>

Templates Parts

Also called boiler plates. These are pieces of code, you can insert in your project.

The file Datei:file_white.png part.php contains a class with two functions that will be called on displaying insert options and for processing them.

Location

  • Datei:folder_blue.png EasyCreator
    • Datei:folder_blue.png templates
      • Datei:folder_blue.png parts
        • Datei:folder_blue.png GROUPNAME
          • Datei:folder_blue.png PARTNAME
            • Datei:folder_blue.png tmpl
              • FILES...
            • Datei:file_php.png part.php

Included parts

Models

Folder Name Description
Datei:folder_blue.png form Data Form Part of admin interface for managing data records.
Datei:folder_blue.png list Data List Part of admin interface for managing data records.
Datei:folder_blue.png simple Simple A simple, empty model

Views

Folder Name Description
Datei:folder_blue.png form Data Form Part of admin interface for managing data records.
Datei:folder_blue.png list Data List Part of admin interface for managing data records.
Datei:folder_blue.png simple Simple A simple, empty view

Controllers

Folder Name Description
Datei:folder_blue.png data Data Form Provides methods to modify data with a specific model.
Datei:folder_blue.png simple Simple A simple, empty controller

Tables

Folder Name Description
Datei:folder_blue.png admin_create Create and Admin Creates a new table with admin interface.
Datei:folder_blue.png admin_map Map and Admin Maps an existing table, creates an admin interface and a menu link.
Datei:folder_blue.png simple Data Maps an existing table to a table class.

Various

Folder Name Description
Datei:folder_blue.png changelog Changelog A standard, empty changelog.
Datei:folder_blue.png package_installer Package Installer Install and Uninstall routine for packages.

Layout

Datei:file_php.png part.php

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
Persönliche Werkzeuge
Team Navigation