Benutzer:Elkuku/Proyektz/EasyCreator/Reusable code

Aus Joomla! Dokumentation
Wechseln zu: Navigation, Suche

Inhaltsverzeichnis

[Bearbeiten] Extension Templates

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

[Bearbeiten] Location

  • Folder blue.png EasyCreator
    • Folder blue.png templates
      • Folder blue.png GROUPNAME
        • Folder blue.png TEMPLATENAME
          • Folder blue.png tmpl
            • FILES and FOLDERS...
          • File txt.png description.ini
          • File txt.png starter.ini

[Bearbeiten] Included extensions

[Bearbeiten] Components

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

[Bearbeiten] Modules

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

[Bearbeiten] Plugins

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

[Bearbeiten] Templates

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

[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 File white.png part.php contains a class with two functions that will be called on displaying insert options and for processing them.

[Bearbeiten] Location

  • Folder blue.png EasyCreator
    • Folder blue.png templates
      • Folder blue.png parts
        • Folder blue.png GROUPNAME
          • Folder blue.png PARTNAME
            • Folder blue.png tmpl
              • FILES...
            • File php.png part.php

[Bearbeiten] Included parts

[Bearbeiten] Models

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

[Bearbeiten] Views

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

[Bearbeiten] Controllers

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

[Bearbeiten] Tables

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

[Bearbeiten] Various

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

[Bearbeiten] Layout

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
Meine Werkzeuge
Namensräume
Varianten
Aktionen
Navigation
Sonstiges
Team Navigation
Werkzeuge