Sviluppo di un componente MVC/aggiunta di un flusso
From Joomla! Documentation
< J3.x:Developing an MVC Component
Articles in This Series
- Introduction
- Developing a Basic Component
- Adding a View to the Site Part
- Adding a Menu Type to the Site Part
- Adding a Model to the Site Part
- Adding a Variable Request in the Menu Type
- Using the Database
- Basic Backend
- Adding Language Management
- Adding Backend Actions
- Adding Decorations to the Backend
- Adding Verifications
- Adding Categories
- Adding Configuration
- Adding ACL
- Adding an Install/Uninstall/Update Script File
- Adding a Frontend Form
- Adding an Image
- Adding a Map
- Adding AJAX
- Adding an Alias
- Using the Language Filter Facility
- Adding a Modal
- Adding Associations
- Adding Checkout
- Adding Ordering
- Adding Levels
- Adding Versioning
- Adding Tags
- Adding Access
- Adding a Batch Process
- Adding Cache
- Adding a Feed
- Adding an Update Server
- Adding Custom Fields
- Upgrading to Joomla4
Questa è una serie di tutorial su come sviluppare un componente secondo il paradigma Model-View-Controller. Component Versione Joomla!.
Comincia con gli articoli di questa serie delle Introduzioni, e naviga tra gli articoli di utilizzando il pulsante di navigazione in basso o il riquadro a destra (gli Articoli di questa serie).
Questo tutorial fa parte di Sviluppo di un componente MVC per Joomla! 3.2 tutorial. ti consigliamo di leggere le lezioni precedenti del tutorial prima di leggere questo.
In questo passaggio aggiungiamo un feed al nostro componente. Un video che accompagna questo tutorial può essere trovato su Adding a Feed.
Introduzione
Se non hai familiarità con i feed, vale la pena fare qualche lettura di base su Internet. Joomla offre la capacità di generare un feed di articoli in primo piano o articoli in una categoria - vedi ad esempio x.html questo tutorial. In questa fase del tutorial abilitiamo funzionalità equivalenti per generare un feed di record di helloworld associati a una categoria di helloworld.
Sul sito Web Joomla è necessario impostare un feed associato a una categoria di articoli
- creando un menu che punta a una pagina web che mostra articoli in una data categoria
- Attivare il modulo Syndication Feed e visualizzarlo su quella voce di menu.
Questo modulo visualizza un simbolo RSS sulla pagina Web che ha dietro di esso un collegamento all'URL del feed RSS o Atom associato a quella categoria di articoli.
Per iscriversi al feed un utente copia questo URL nel proprio aggregatore di feed. Quando l'aggregatore di feed invia una richiesta HTTP a questo URL, il sito Web Joomla restituisce un documento XML contenente i dettagli degli articoli in quella categoria: titoli, descrizioni, date pubblicate, ecc.
Ad esempio, se la pagina Web visualizza un elenco degli articoli associati a una "tecnologia" di categoria, l'URL dietro l'immagine RSS punterà al feed associato. Quando un browser o aggregatore di feed invia una richiesta HTTP a tale URL di feed, il server restituirà un documento XML in formato RSS o Atom contenente i dettagli di quegli articoli con una categoria di "tecnologia".
In questo modo un aggregatore di feed può inviare richieste HTTP a tutti i feed a cui l'utente si è iscritto e confrontarli in modo che l'utente non debba visitare ciascuno dei singoli siti Web di notizie. E l'utente può configurare l'aggregatore di notizie per controllare i feed in momenti specifici, in modo che le informazioni possano essere già raccolte e raccolte nel momento in cui l'utente desidera visualizzarle.
Nota che oltre al feed sindacato che stiamo prendendo in considerazione qui, Joomla ha anche una capacità di newsfeed, che ti consente di visualizzare una pagina web che mostra le informazioni raccolte da feed sindacati altrove - simile a quello che farebbe un aggregatore di feed - ma questo non è la funzionalità di cui tratta questo passaggio.
Approach
Al momento abbiamo una vista di categoria del sito che mostra i record di helloworld associati a una determinata categoria. In questo passaggio aggiungiamo un feed RSS sindacato a questa pagina. Ciò si tradurrà in un simbolo RSS mostrato come immagine, con un URL dietro il quale fornirà un feed XML in formato RSS o Atom dei record di helloworld associati a quella categoria.
Se non hai già un menu del sito che punta a una vista di categoria, dovresti configurarne uno come punto di partenza.
Per abilitare il feed sindacato dobbiamo fare quanto segue.
- In Moduli, trova e abilita il modulo Feed Syndicated. Fai clic su questo modulo per modificarne le opzioni e, nella scheda Assegnazione menu, assicurati che sia mostrato solo nella pagina del sito che mostra la vista della categoria helloworld. Nota che tra le opzioni ce n'è una che definisce se Joomla presenta i dati XML nel formato RSS o Atom.
- Definisce un parametro di configurazione di helloworld che controlla se viene mostrato o meno il simbolo RSS con il suo link. Il codice Joomla visualizza il simbolo RSS solo se trova questo parametro ed è impostato su Mostra.
- Nella categoria view.html.php abbiamo bisogno di ereditare da JViewCategoryViewCategory (che nello schema rivisto di namespacing è CategoryView in namespace Joomla\MVC\MVC\MVC\View) e chiamare il metodo addFeed() di questa classe. Questo metodo inserisce i link RSS/Atom nel documento <head> - dove il modulo Syndicated Feed si aspetta di trovare l'URL per mettere dietro il simbolo RSS.
- The URL for the RSS feed includes the query parameter "format=feed" so we need to have a file view.feed.php and the code for this new file is found below. Note that it inherits from the class JViewCategoryfeed, or in the newer namespaced structure CategoryFeedView within the namespace Joomla\CMS\MVC\View.
- Includere nella query SQL all'interno del modello di categoria helloworld tutti i campi che si desidera compilare all'interno del documento XML del feed RSS/Atom.
L'URL del feed RSS sarà qualcosa di simile: http://yourDomain.com/yourJoomlaInstance/index.php?option=com_helloworld&view=category&id=37&Itemid=822&lang=en&format=feed&type=rss When Joomla receives a URL like this, it handles it in the same way as usual:
- l'opzione è "com_helloworld", quindi eseguirà il nostro file helloworld.php.
- it will run the display() method within the helloworld controller – this will as usual set up the view and the model
- because the URL parameter format = "feed" it will expect the view to be in ./views/category/view.feed.html and will run the HelloworldViewCategory::display() method.
- this display() code is found from the parent class JViewCategoryfeed / CategoryFeedView. This is the code which brings together the data to be put into the response XML document – for example, the titles, descriptions, links – mapping them from the fields in the SQL query result, and I would recommend looking through the code to get an idea of what it does.
- it calls $this->get('Items'), which gets translated into a call getItems() in the model – so we need to ensure that our SQL query in this function provides all the fields we want to be present in the RSS XML response.
- it calls $this->get('Category'), so we need to have a method getCategory() in our model
- it maps some of the fields using the ucm content-types field mapping data which we supplied in the step Adding Tags. To find the correct record in this table it uses the key formed by the extension ("com_helloworld") and the view ("helloworld"), so this is why we need to set the $viewname property in this class.
- it allows us to define mappings of other fields through the method reconcileNames(). We use this to include in the description field a link to the associated image.
Modifiche alla configurazione
Seguendo la pratica standard di Joomla, mettiamo l'opzione Show Feed Link nella scheda di integrazione delle opzioni di configurazione di Helloworld.
admin/config.xml
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset
name="greetings"
label="COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_LABEL"
description="COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_DESC"
>
<field
name="show_category"
type="radio"
label="COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_LABEL"
description="COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_DESC"
default="0"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="captcha"
type="plugins"
folder="captcha"
label="COM_HELLOWORLD_HELLOWORLD_FIELD_CAPTCHA_LABEL"
description="COM_HELLOWORLD_HELLOWORLD_FIELD_CAPTCHA_DESC"
default="0"
filter="cmd"
>
<option value="">JOPTION_USE_DEFAULT</option>
<option value="0">JOPTION_DO_NOT_USE</option>
</field>
<field
name="user_to_email"
type="user"
label="COM_HELLOWORLD_HELLOWORLD_FIELD_USER_TO_EMAIL_LABEL"
description="COM_HELLOWORLD_HELLOWORLD_FIELD_USER_TO_EMAIL_DESC"
default="0"
>
</field>
<field
name="save_history"
type="radio"
class="btn-group btn-group-yesno"
default="1"
label="JGLOBAL_SAVE_HISTORY_OPTIONS_LABEL"
description="JGLOBAL_SAVE_HISTORY_OPTIONS_DESC"
>
<option
value="0">JNO</option>
<option
value="1">JYES</option>
</field>
<field
name="history_limit"
type="text"
filter="integer"
label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL"
description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC"
default="5"
>
</field>
</fieldset>
<fieldset name="integration"
label="JGLOBAL_INTEGRATION_LABEL"
description="COM_HELLOWORLD_CONFIG_INTEGRATION_SETTINGS_DESC"
>
<field
name="show_feed_link"
type="radio"
class="btn-group btn-group-yesno"
default="1"
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
description="JGLOBAL_SHOW_FEED_LINK_DESC">
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
</fieldset>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC"
>
<field
name="rules"
type="rules"
label="JCONFIG_PERMISSIONS_LABEL"
class="inputbox"
validate="rules"
filter="rules"
component="com_helloworld"
section="component"
/>
</fieldset>
</config>
Category View code files
In our updated category view html file we change the class we're inheriting from and include a call to the parent addFeed() method. This method expects the params to have been set.
site/views/category/view.html.php
<?php
/*
* View file for the view which displays a list of helloworld messages in a given category
*/
defined('_JEXEC') or die;
class HelloworldViewCategory extends JViewCategory
{
public function display($tpl = null)
{
$this->categoryName = $this->get("CategoryName");
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->subcategories = $this->get('Subcategories');
$this->params = JFactory::getApplication()->getParams();
parent::display($tpl);
}
protected function prepareDocument()
{
parent::prepareDocument();
parent::addFeed();
}
}
We also have the new view file for the feed format.
site/views/category/view.feed.php
<?php
/**
* view file associated with the Syndicated Feed for a helloworld category
*/
defined('_JEXEC') or die;
class HelloworldViewCategory extends JViewCategoryfeed
{
// required so that the parent class can find the helloworld content-type record containing the field mapping details
protected $viewName = 'helloworld';
/**
* Function overriding the parent reconcileNames() method.
* We use this to insert an html link to the helloworld image into the description
*
* The input parameter is the helloworld item as extracted from the database, passed by reference
*
* The result of the method is that the helloworld item passed as a parameter gets its description property changed
*/
protected function reconcileNames($item)
{
$description = '';
if (!empty($item->image))
{
// Convert the JSON-encoded image info into an array
$imageDetails = new JRegistry;
$imageDetails->loadString($item->image, 'JSON');
$src = $imageDetails->get('image','');
if (!empty($src))
{
$description .= '<p><img src="' . $src . '" /></p>';
}
}
$item->description = $description . $item->description;
}
}
Model changes
site/models/category.php
<?php
/**
* Model for displaying the helloworld messages in a given category
*/
defined('_JEXEC') or die;
class HelloworldModelCategory extends JModelList
{
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'id',
'greeting',
'alias',
'lft',
);
}
parent::__construct($config);
}
protected function populateState($ordering = null, $direction = null)
{
parent::populateState($ordering, $direction);
$app = JFactory::getApplication('site');
$catid = $app->input->getInt('id');
$this->setState('category.id', $catid);
}
protected function getListQuery()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$catid = $this->getState('category.id');
$query->select('id, greeting, alias, catid, access, description, image')
->from($db->quoteName('#__helloworld'))
->where('catid = ' . $catid);
if (JLanguageMultilang::isEnabled())
{
$lang = JFactory::getLanguage()->getTag();
$query->where('language IN ("*","' . $lang . '")');
}
$orderCol = $this->state->get('list.ordering', 'lft');
$orderDirn = $this->state->get('list.direction', 'asc');
$query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn));
return $query;
}
public function getCategoryName()
{
$catid = $this->getState('category.id');
$categories = JCategories::getInstance('Helloworld', array('access' => false));
$categoryNode = $categories->get($catid);
return $categoryNode->title;
}
public function getSubcategories()
{
$catid = $this->getState('category.id');
$categories = JCategories::getInstance('Helloworld', array('access' => false));
$categoryNode = $categories->get($catid);
$subcats = $categoryNode->getChildren();
$lang = JFactory::getLanguage()->getTag();
if (JLanguageMultilang::isEnabled() && $lang)
{
$query_lang = "&lang={$lang}";
}
else
{
$query_lang = '';
}
foreach ($subcats as $subcat)
{
$subcat->url = JRoute::_("index.php?view=category&id=" . $subcat->id . $query_lang);
}
return $subcats;
}
public function getCategoryAccess()
{
$catid = $this->getState('category.id');
$categories = JCategories::getInstance('Helloworld', array('access' => false));
$categoryNode = $categories->get($catid);
return $categoryNode->access;
}
public function getItems()
{
$items = parent::getItems();
$user = JFactory::getUser();
$loggedIn = $user->get('guest') != 1;
if ($user->authorise('core.admin')) // ie superuser
{
return $items;
}
else
{
$userAccessLevels = $user->getAuthorisedViewLevels();
$catAccess = $this->getCategoryAccess();
if (!in_array($catAccess, $userAccessLevels))
{ // the user hasn't access to the category
if ($loggedIn)
{
return array();
}
else
{
foreach ($items as $item)
{
$item->canAccess = false;
}
return $items;
}
}
foreach ($items as $item)
{
if (!in_array($item->access, $userAccessLevels))
{
if ($loggedIn)
{
unset($item);
}
else
{
$item->canAccess = false;
}
}
}
}
return $items;
}
public function getCategory()
{
$categories = JCategories::getInstance('Helloworld', array());
$category = $categories->get($this->getState('category.id', 'root'));
return $category;
}
}
Updated Language Strings
admin/language/en-GB/en-GB.com_helloworld.ini
; Joomla! Project
; Copyright (C) 2005 - 2018 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8
COM_HELLOWORLD_ADMINISTRATION="HelloWorld - Administration"
COM_HELLOWORLD_ADMINISTRATION_CATEGORIES="HelloWorld - Categories"
COM_HELLOWORLD_NUM="#"
COM_HELLOWORLD_HELLOWORLDS_FILTER="Filters"
COM_HELLOWORLD_AUTHOR="Author"
COM_HELLOWORLD_LANGUAGE="Language"
COM_HELLOWORLD_CREATED_DATE="Created"
COM_HELLOWORLD_PUBLISHED="Published"
COM_HELLOWORLD_HELLOWORLDS_NAME="Name"
COM_HELLOWORLD_HELLOWORLDS_POSITION="Position"
COM_HELLOWORLD_HELLOWORLDS_IMAGE="Image"
COM_HELLOWORLD_HELLOWORLDS_ASSOCIATIONS="Associations"
COM_HELLOWORLD_ID="Id"
COM_HELLOWORLD_HELLOWORLD_CREATING="HelloWorld - Creating"
COM_HELLOWORLD_HELLOWORLD_DETAILS="Details"
COM_HELLOWORLD_HELLOWORLD_EDITING="HelloWorld - Editing"
COM_HELLOWORLD_HELLOWORLD_ERROR_UNACCEPTABLE="Some values are unacceptable"
COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_DESC="The category the messages belongs to"
COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_LABEL="Category"
COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC="This message will be displayed"
COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL="Message"
COM_HELLOWORLD_HELLOWORLD_FIELD_DESCRIPTION_DESC="Message description"
COM_HELLOWORLD_HELLOWORLD_FIELD_DESCRIPTION_LABEL="Description"
COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_LABEL="Show category"
COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_DESC="If set to Show, the title of the message’s category will show."
COM_HELLOWORLD_HELLOWORLD_FIELD_LATITUDE_LABEL="Latitude"
COM_HELLOWORLD_HELLOWORLD_FIELD_LATITUDE_DESC="Enter the position latitude, between -90 and +90 degrees"
COM_HELLOWORLD_HELLOWORLD_FIELD_LONGITUDE_LABEL="Longitude"
COM_HELLOWORLD_HELLOWORLD_FIELD_LONGITUDE_DESC="Enter the position longitude, between -180 and +180 degrees"
COM_HELLOWORLD_HELLOWORLD_FIELD_PARENT_LABEL="Parent"
COM_HELLOWORLD_HELLOWORLD_FIELD_PARENT_DESC="Select the parent record"
COM_HELLOWORLD_ITEM_FIELD_ORDERING_VALUE_FIRST="-- First record"
COM_HELLOWORLD_ITEM_FIELD_ORDERING_VALUE_LAST="-- Last record"
COM_HELLOWORLD_ITEM_FIELD_ORDERING_TEXT="Ordering will be available after saving."
COM_HELLOWORLD_HELLOWORLD_FIELD_LANGUAGE_DESC="Select the appropriate language"
COM_HELLOWORLD_IMAGE_FIELDS="Image details"
COM_HELLOWORLD_HELLOWORLD_FIELD_IMAGE_LABEL="Select image"
COM_HELLOWORLD_HELLOWORLD_FIELD_IMAGE_DESC="Select an image from the library, or upload a new one"
COM_HELLOWORLD_HELLOWORLD_FIELD_ALT_LABEL="Alt text"
COM_HELLOWORLD_HELLOWORLD_FIELD_ALT_DESC="Alternative text (if image cannot be displayed)"
COM_HELLOWORLD_HELLOWORLD_FIELD_CAPTION_LABEL="Caption"
COM_HELLOWORLD_HELLOWORLD_FIELD_CAPTION_DESC="Provide a caption for the image"
COM_HELLOWORLD_HELLOWORLD_HEADING_GREETING="Greeting"
COM_HELLOWORLD_HELLOWORLD_HEADING_ID="Id"
COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT="HelloWorld manager: Edit Message"
COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW="HelloWorld manager: New Message"
COM_HELLOWORLD_MANAGER_HELLOWORLDS="HelloWorld manager"
COM_HELLOWORLD_EDIT_HELLOWORLD="Edit message"
COM_HELLOWORLD_N_ITEMS_DELETED_1="One message deleted"
COM_HELLOWORLD_N_ITEMS_DELETED_MORE="%d messages deleted"
COM_HELLOWORLD_N_ITEMS_PUBLISHED="%d message(s) published"
COM_HELLOWORLD_N_ITEMS_UNPUBLISHED="%d message(s) unpublished"
COM_HELLOWORLD_HELLOWORLD_GREETING_LABEL="Greeting"
COM_HELLOWORLD_HELLOWORLD_GREETING_DESC="Add Hello World Greeting"
COM_HELLOWORLD_SUBMENU_MESSAGES="Messages"
COM_HELLOWORLD_SUBMENU_CATEGORIES="Categories"
COM_HELLOWORLD_CONFIGURATION="HelloWorld Configuration"
COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_LABEL="Messages settings"
COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_DESC="Settings that will be applied to all messages by default"
COM_HELLOWORLD_CONFIG_INTEGRATION_SETTINGS_DESC="Settings relating to integration with the Syndicated Feed module"
COM_HELLOWORLD_HELLOWORLD_FIELD_CAPTCHA_LABEL="Captcha"
COM_HELLOWORLD_HELLOWORLD_FIELD_CAPTCHA_DESC="Select Captcha to use on front end form"
COM_HELLOWORLD_HELLOWORLD_FIELD_USER_TO_EMAIL_LABEL="User to email"
COM_HELLOWORLD_HELLOWORLD_FIELD_USER_TO_EMAIL_DESC="Select user to email when a new message is entered on front end"
COM_HELLOWORLD_FIELDSET_RULES="Message Permissions"
COM_HELLOWORLD_FIELD_RULES_LABEL="Permissions"
COM_HELLOWORLD_ACCESS_DELETE_DESC="Is this group allowed to edit this message?"
COM_HELLOWORLD_ACCESS_DELETE_DESC="Is this group allowed to delete this message?"
COM_HELLOWORLD_TAB_NEW_MESSAGE="New Message"
COM_HELLOWORLD_TAB_EDIT_MESSAGE="Message Details"
COM_HELLOWORLD_TAB_PARAMS="Parameters"
COM_HELLOWORLD_TAB_ASSOCIATIONS="Associations"
COM_HELLOWORLD_TAB_PERMISSIONS="Permissions"
COM_HELLOWORLD_TAB_IMAGE="Image"
COM_HELLOWORLD_LEGEND_DETAILS="Message Details"
COM_HELLOWORLD_LEGEND_PARAMS="Message Parameters"
COM_HELLOWORLD_LEGEND_ASSOCIATIONS="Message Associations"
COM_HELLOWORLD_LEGEND_PERMISSIONS="Message Permissions"
COM_HELLOWORLD_LEGEND_IMAGE="Image info"
; Column ordering in the Helloworlds view
COM_HELLOWORLD_ORDERING_ASC="Ordering ascending"
COM_HELLOWORLD_ORDERING_DESC="Ordering descending"
COM_HELLOWORLD_GREETING_ASC="Greeting ascending"
COM_HELLOWORLD_GREETING_DESC="Greeting descending"
COM_HELLOWORLD_AUTHOR_ASC="Author ascending"
COM_HELLOWORLD_AUTHOR_DESC="Author descending"
COM_HELLOWORLD_CREATED_ASC="Creation date ascending"
COM_HELLOWORLD_CREATED_DESC="Creation date descending"
COM_HELLOWORLD_PUBLISHED_ASC="Unpublished first"
COM_HELLOWORLD_PUBLISHED_DESC="Published first"
COM_HELLOWORLD_LANGUAGE_ASC="Language ascending"
COM_HELLOWORLD_LANGUAGE_DESC="Language descending"
COM_HELLOWORLD_ASSOCIATION_ASC="Association ascending"
COM_HELLOWORLD_ASSOCIATION_DESC="Association descending"
COM_HELLOWORLD_ACCESS_ASC="Access ascending"
COM_HELLOWORLD_ACCESS_DESC="Access descending"
; Helloworld menuitem - selecting a greeting via modal
COM_HELLOWORLD_MENUITEM_SELECT_MODAL_TITLE="Select greeting"
COM_HELLOWORLD_MENUITEM_SELECT_HELLOWORLD="Select"
COM_HELLOWORLD_MENUITEM_SELECT_BUTTON_TOOLTIP="Select a helloworld greeting"
; Checking in records
COM_HELLOWORLD_N_ITEMS_CHECKED_IN_0="No records checked in."
COM_HELLOWORLD_N_ITEMS_CHECKED_IN_1="%d record successfully checked in."
COM_HELLOWORLD_N_ITEMS_CHECKED_IN_MORE="%d records successfully checked in."
; Batch functionality
COM_HELLOWORLD_BATCH_OPTIONS="Helloworld component batch options"
COM_HELLOWORLD_BATCH_SETPOSITION_LABEL="Set location"
COM_HELLOWORLD_BATCH_KEEP_POSITION="Keep existing location"
COM_HELLOWORLD_BATCH_CHANGE_POSITION="Change location"
Packaging the Component
Contents of your code directory. Each file link below takes you to the step in the tutorial which has the latest version of that source code file.
- helloworld.xml
- script.php
- site/router.php
- site/helloworld.php
- site/index.html
- site/controller.php
- site/controllers/helloworld.php
- site/views/index.html
- site/views/helloworld/index.html
- site/views/helloworld/view.html.php
- site/views/helloworld/view.json.php
- site/views/helloworld/tmpl/index.html
- site/views/helloworld/tmpl/default.xml
- site/views/helloworld/tmpl/default.php
- site/views/form/index.html
- site/views/form/view.html.php
- site/views/form/tmpl/index.html
- site/views/form/tmpl/edit.php
- site/views/form/tmpl/edit.xml
- site/views/category/index.html
- site/views/category/view.html.php
- site/views/category/view.feed.php
- site/views/category/tmpl/index.html
- site/views/category/tmpl/default.php
- site/views/category/tmpl/default.xml
- site/models/index.html
- site/models/helloworld.php
- site/models/form.php
- site/models/category.php
- site/models/forms/index.html
- site/models/forms/add-form.xml
- site/models/forms/filter_category.xml
- site/language/index.html
- site/language/en-GB/index.html
- site/language/en-GB/en-GB.com_helloworld.ini
- site/helpers/index.html
- site/helpers/route.php
- site/helpers/category.php
- site/helpers/association.php
- admin/index.html
- admin/helloworld.php
- admin/config.xml
- admin/controller.php
- admin/access.xml
- admin/helpers/helloworld.php
- admin/helpers/associations.php
- admin/helpers/index.html
- admin/helpers/html/helloworlds.php
- admin/helpers/html/index.html
- admin/sql/index.html
- admin/sql/install.mysql.utf8.sql
- admin/sql/uninstall.mysql.utf8.sql
- admin/sql/updates/index.html
- admin/sql/updates/mysql/index.html
- admin/sql/updates/mysql/0.0.1.sql
- admin/sql/updates/mysql/0.0.6.sql
- admin/sql/updates/mysql/0.0.12.sql
- admin/sql/updates/mysql/0.0.13.sql
- admin/sql/updates/mysql/0.0.14.sql
- admin/sql/updates/mysql/0.0.16.sql
- admin/sql/updates/mysql/0.0.17.sql
- admin/sql/updates/mysql/0.0.18.sql
- admin/sql/updates/mysql/0.0.20.sql
- admin/sql/updates/mysql/0.0.21.sql
- admin/sql/updates/mysql/0.0.24.sql
- admin/sql/updates/mysql/0.0.25.sql
- admin/sql/updates/mysql/0.0.26.sql
- admin/sql/updates/mysql/0.0.27.sql
- admin/sql/updates/mysql/0.0.28.sql
- admin/sql/updates/mysql/0.0.29.sql
- admin/models/index.html
- admin/models/fields/index.html
- admin/models/fields/helloworld.php
- admin/models/fields/helloworldordering.php
- admin/models/fields/helloworldparent.php
- admin/models/fields/modal/index.html
- admin/models/fields/modal/helloworld.php
- admin/models/helloworlds.php
- admin/models/helloworld.php
- admin/models/forms/filter_helloworlds.xml
- admin/models/forms/index.html
- admin/models/forms/helloworld.js
- admin/models/forms/helloworld.xml
- admin/models/rules/greeting.php
- admin/models/rules/index.html
- admin/controllers/helloworld.php
- admin/controllers/helloworlds.php
- admin/controllers/index.html
- admin/views/index.html
- admin/views/helloworld/index.html
- admin/views/helloworld/view.html.php
- admin/views/helloworld/tmpl/index.html
- admin/views/helloworld/tmpl/edit.php
- admin/views/helloworld/submitbutton.js
- admin/views/helloworlds/index.html
- admin/views/helloworlds/view.html.php
- admin/views/helloworlds/tmpl/index.html
- admin/views/helloworlds/tmpl/default.php
- admin/views/helloworlds/tmpl/default_batch_body.php
- admin/views/helloworlds/tmpl/default_batch_footer.php
- admin/views/helloworlds/tmpl/modal.php
- admin/layouts/index.html
- admin/layouts/position.php
- admin/tables/index.html
- admin/tables/helloworld.php
- admin/language/index.html
- admin/language/en-GB/index.html
- admin/language/en-GB/en-GB.com_helloworld.ini
- admin/language/en-GB/en-GB.com_helloworld.sys.ini
- media/index.html
- media/images/index.html
- media/images/tux-16x16.png
- media/images/tux-48x48.png
- media/js/index.html
- media/js/openstreetmap.js
- media/js/admin-helloworlds-modal.js
- media/css/index.html
- media/css/openstreetmap.css
helloworld.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.0" method="upgrade">
<name>COM_HELLOWORLD</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>January 2018</creationDate>
<author>John Doe</author>
<authorEmail>john.doe@example.org</authorEmail>
<authorUrl>http://www.example.org</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.0.32</version>
<!-- The description is optional and defaults to the name -->
<description>COM_HELLOWORLD_DESCRIPTION</description>
<!-- Runs on install/uninstall/update; New in 2.5 -->
<scriptfile>script.php</scriptfile>
<install> <!-- Runs on install -->
<sql>
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
</sql>
</install>
<uninstall> <!-- Runs on uninstall -->
<sql>
<file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
</sql>
</uninstall>
<update> <!-- Runs on update; New since J2.5 -->
<schemas>
<schemapath type="mysql">sql/updates/mysql</schemapath>
</schemas>
</update>
<!-- Site Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder
to copy FROM in the package to install therefore files copied
in this section are copied from /site/ in the package -->
<files folder="site">
<filename>index.html</filename>
<filename>helloworld.php</filename>
<filename>controller.php</filename>
<filename>router.php</filename>
<folder>controllers</folder>
<folder>views</folder>
<folder>models</folder>
<folder>helpers</folder>
</files>
<languages folder="site/language">
<language tag="en-GB">en-GB/en-GB.com_helloworld.ini</language>
<language tag="fr-FR">fr-FR/fr-FR.com_helloworld.ini</language>
</languages>
<media destination="com_helloworld" folder="media">
<filename>index.html</filename>
<folder>images</folder>
<folder>js</folder>
<folder>css</folder>
</media>
<administration>
<!-- Administration Menu Section -->
<menu link='index.php?option=com_helloworld' img="../media/com_helloworld/images/tux-16x16.png">COM_HELLOWORLD_MENU</menu>
<!-- Administration Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder
to copy FROM in the package to install therefore files copied
in this section are copied from /admin/ in the package -->
<files folder="admin">
<!-- Admin Main File Copy Section -->
<filename>index.html</filename>
<filename>config.xml</filename>
<filename>helloworld.php</filename>
<filename>controller.php</filename>
<filename>access.xml</filename>
<!-- SQL files section -->
<folder>sql</folder>
<!-- tables files section -->
<folder>tables</folder>
<!-- models files section -->
<folder>models</folder>
<!-- views files section -->
<folder>views</folder>
<!-- controllers files section -->
<folder>controllers</folder>
<!-- helpers files section -->
<folder>helpers</folder>
<!-- layout files section -->
<folder>layouts</folder>
</files>
<languages folder="admin/language">
<language tag="en-GB">en-GB/en-GB.com_helloworld.ini</language>
<language tag="en-GB">en-GB/en-GB.com_helloworld.sys.ini</language>
<language tag="fr-FR">fr-FR/fr-FR.com_helloworld.ini</language>
<language tag="fr-FR">fr-FR/fr-FR.com_helloworld.sys.ini</language>
</languages>
</administration>
</extension>