Joomla!
Framework
101
A Virtual Tour
Methods to
• Remember
jimport(‘dot.separated.path.to.library’);
JText::_(‘String_To_Translate’);
• JRoute::_(‘index.php?option=com_foo&...
’);
• Everything in the JFactory class
JFactory::getDBO()
• JFactory::getDocument()
JFactory::getUser() , etc.
The Most Important
Packages
• Application
Database
• Document
• Environment
• Html
The Application
Package
• Model-View-Controller libraries
Application library
• Menu library
Module and Component helper libraries.
Model-View-Controller
• Controller manages the request
Two principle request types
• View based -- GET
• Task based -- POST
• Controllers choose and instantiate
Models and Views for the request
Model-View-Controller
• Models manage data
Models strive to be request agnostic
• Views manage presentation
• Views get data from Models through
get()
eg. $this->get(‘List’); calls
MyModel::getList();
• Views include layouts to render output
Application Library
• Application object is at the center of
Joomla
Loads configuration
• Initializes session
• Routes request
Executes component
• Renders document
Database Package
• Database library
Simple and lightweight
• Sanitize data before insert or update
Always check for errors
Database Package
• Table library
Encapsulates a database table/row
• Add your own with:
JTable::addIncludePath(‘/path/to/files/’)
;
• Provides some basic features common
to Joomla related tables
• Always implement the check() method
Document Package
• Document library encapsulates all
output to the browser
Several document types
• HTML is default
• RAW is magic
• view.html.php - view.feed.php -
view.csv.php
Environment Package
• Browser library detects browser
Request library is your friend
• Filters data based on what you need
• Integers, words, floats, paths, etc.
Response library handles headers and
body
• URI library allows manipulation and
detection
HTML Package
• HTML goes in layouts
HTML goes in layouts
• HTML goes in layouts
• HTML goes in layouts
HTML goes in layouts
• HTML goes in layouts
HTML Package
• JHtml::_(‘{CLASS}.{METHOD}’, $arg1,
...);
Add your own with:
JHtml::addIncludePath(‘/path/to/files’);
• Editor library
• Pagination library
• Pane library
The Rest of the
Packages
• Base
• Cache
• Client
• Error
• Event
The Rest of the
Packages
• Filesystem
• Filter
• Installer
• Language
• Mail
The Rest of the
Packages
• Plugin
• Registry
• Session
• Template
• User
• Utilities
Bien plus que des documents.
Découvrez tout ce que Scribd a à offrir, dont les livres et les livres audio des principaux éditeurs.
Annulez à tout moment.