SlideShare una empresa de Scribd logo
1 de 65
How Joomla!
Builds a Web Page
implications for flexibility, plugins, cache, and special formats
Randy Carey
Careytech Studios, LLC
Careytech.com
Randy Carey
CAREYTECH.COM
agenda
 Joomla! as a CMS
 Joomla’s Flexibility
 MVC
 How Joomla builds a page
 plugins
 caching
 APIs / JSON responses
I feel Joomla is a true CMS. While it does generate
websites, look deeper and you’ll see it manages content
and metadata as independent of the output type (a web
page, an RSS feed, JSON, etc).
As a true CMS, Joomla has a process for how it takes the
content and builds the output that is requested. We’ll be
looking primarily at Joomla builds a webpage.
dynamic CMS
vs static
The original websites were a
collection of HTML files, each
edited and managed by hand
and per file
These days a dynamic CMS separates
content from formatting and the page
layout. The page is build frequently
so it can use the most recent versions
of content and layout.
Flexibility
This diagram reflects the considerable flexibility that
we get from Joomla. Let’s review each “flex point”
to help us appreciate the flexibility this system buys
us…
Flexibility 1. A Modules is assigned to ONE particular position.
2. A Module is assigned to its own set of menu
items (all, none, or a custom selection).
… I bet you already knew that
position assignment
page assignments
Flexibility3. Each template has its own set of named module positions. So …
• a particular position name may exist in one template, but not in another.
• Also, for any given template, the same name may occupy a different position
within the layout. The example below suggests this.
If we introduce multiple templates (or template styles) within our installation, we
have the opportunity to introduce a lot of flexibility
Flexibility
4. Each menu item has a dropdown field allowing you to declare which template it
should use. Typically we ignore it and Default is always used. But there is
nothing stopping you from setting that field so that certain menu items use a
variant template.
Since each template can layout the positions differently (and apply different
styling), we have the potential additional flexibilities that you probably have not
even thought about. … Let me show you an application of this…
Flexibility
default CTA media-room mods-only
I use Gantry 5, and that framework allows me to set a different layout for each
template style. (same template, different “style”) In this example, the layouts and some
position names differ across templates.
Consider CTA (call-to-action). If a page is set to a CTA template, that page will
automatically the CTA module (a sidebar form) that I set up for the site.
Flexibility
The template/style assignment is
made on the menu item. All my
styles are listed as an option.
In this example, I can set a page
to a layout that will exclude the
component.
Flexibility
overrides
5. But let’s not forget that alternative layouts (overrides)
also introduce flexibility. Create multiple module
templates and the user can select alternate outputs.
These can vary slightly or greatly.
…Flexibility accessed through a simple dropdown field.
Flexibility
overrides
This diagram reflects 1, 2, 3, 4, FIVE
flex-points that provide the
considerable flexibility we get from
Joomla’s module system.
MVC
You’ve probably heard of Joomla’s MVC. Each component has its own set.
(some rogue developers try to short-circuit this, but that is another story)
This is an important feature of Joomla’s architecture. We’ll just summarize…
MVC
The component’s Controller
interprets the request that is
implied by the URL. It then
creates and launches the
correct model-view objects.
(example: the MVC to display an article
versus the MVC to display a category
list)
It should be noted that each Model-
View pair can have its own controller to
handle view-specific tasks such as
logging in a user or performing front-
end editing tasks.
MVC
The Model manages the data
that flows between a
component and the database.
It implements things like
save, update, delete, as well
as maintaining rules (such as
returning only content that the user is
allowed to access).
MVC
Each View knows its output type
(HTML, RSS, etc) and orchestrates
function calls accordingly. These
functons could be for setting
metadata or managing pagination.
For an HTML page, it calls upon the
appropriate template to build the
HTML using the data that the
model provided.
MVC
1. execute( )
2. display( )
3. gets/returns data
4. injects metadata/CSS/JS, other housekeeping.
5. calls upon template to render the HTML
using the data it received
is created
creates respective View
asks its Model for data
The red text below outlines the order of steps taken
by a component when a webpage is being built.
A. We’ve outlined the flexibility we have with Joomla’s module
system.
B. We’ve summarize what happens when a component is invoked
during the page-building process.
C. Now… Let’s step back and look at the steps Joomla
takes as it builds a web page …. From the time it
gets a URL to the time it sends the respective
HTML back to the requesting browser.
How Joomla builds a page
How Joomla builds a page
1. loads Joomla framework, gets user session
The next slide show some of
the things that get set up
How Joomla builds a page
1. loads Joomla framework, gets user session
Document
Application
JFactory
Session
PATHS: /home/public_html/…
Cookies
Server variables
• URL parameters
• language
User
How Joomla builds a page
1. loads Joomla framework, gets user session
2. determines parameters (option, etc)
Every page has one and only one component. This is
always implied by the URL.
Joomla’s routing system parses the URL to determine
the component as well as other related settings (such
as view, id, or task)
How Joomla builds a page
2. determines parameters (option, etc)
option = com_content
view = article
id = 758
itemid = 133
task =
template =
format =
Router Parses URL
These values are obtained
from parsing the URL
and possibly from GET/POST values.
How Joomla builds a page
1. loads Joomla framework, gets user session
2. determines parameters (option, etc)
3. render Component
Now that we know what component to call and we have all the
variables it expects, we ask the component to render itself into HTML.
How Joomla builds a page
3. render Component
Document • Rendered HTML
• Title
• Styles
• Scripts
• Metadata
• Base URL (SEF)
The Document object stores
the HTML for this component
along with other values
associated to what was
rendered.
NOTE: Joomla is just building the pieces and storing each. It has
yet to assemble them into any type of output (such as a webpage).
How Joomla builds a page
1. loads Joomla framework, gets user session
2. determines parameters (option, etc)
3. render Component
4. determine template and module positions
How Joomla builds a page
4. determine template and module positions
Document • template HTML
• template name
• Styles
• Scripts
• Module Positions (template tags)
Again, each piece is stored
within the Document object.
In addition to the template’s
HTML, other pieces include CSS
and JS declarations, as well as
a list names for each module
position held by the template.
How Joomla builds a page
4. determine template and module positions
Document • template HTML
• template name
• Styles
• Scripts
• Module Positions (template tags)
Note:
Only those position names
found within the template are
stored. When Joomla renders the
modules, it will consider only those
modules belonging to a position
within the template.
Consider the “component” template that is
meant to display just the component but no
modules: It contains no module positons.
How Joomla builds a page
4. determine template and module positions
Document • template HTML
• template name
• Styles
• Scripts
• Module Positions (template tags)
only if
format is
HTML
If the format is to be RSS,
JSON, or something other
than HTML (a webpage),
then there is no need to
process a template.
How Joomla builds a page
1. loads Joomla framework, gets user session
2. determines parameters (option, etc)
3. render Component
4. determine template and module positions
5. render modules
How Joomla builds a page
5. render modules
For each module position to be
processed, Joomla queries the
database for those modules.
In addition to module position, the
query also limits results to the current
menu item, the current language,
the current access level, and a state
of published.
Each module returned by the database
is rendered individually…
How Joomla builds a page
5. render modules
Document • modules HTML
For each module:
• HTML
• Styles
• Scripts
Each module’s HTML is stored
in the Document.
If a module includes a
dependency upon a CSS or
JS file, that reference is
added to the Document.
What happens if the same CSS or JS is
included by multiple modules? …
How Joomla builds a page
5. render modules
Document • modules HTML
For each module:
• HTML
• Styles
• Scripts
What happens if the same CSS or JS
is included by multiple modules?
No problem. The document will keep
only one reference to a file if
duplicates are added during the
page-building process.
How Joomla builds a page
1. loads Joomla framework, gets user session
2. determines parameters (option, etc)
3. render Component
4. determine template and module positions
5. render modules
6. assemble parts into page / output
At this point we have all the HTML pieces,
metadata, and JSS/CSS references
collected.
Time to let Joomla assemble all these
parts into the page according to the
template.
How Joomla builds a page
Document
• Styles
• Scripts
• Metadata
The document is holding all the
parts. Time to assemble them
into the output (in our case, a webpage)
How Joomla builds a page
6. assemble parts into page / output
• page HTML
How Joomla builds a page
6. assemble parts into page / output
• page HTML
if page is
not cached
If page-caching is on and the page was cached…
the page-building process concluded a few steps
back – we would never reached this point.
How Joomla builds a page
1. loads Joomla framework, gets user session
2. determines parameters (option, etc)
3. render Component
4. determine template and module positions
5. render modules
6. assemble parts into page / output
7. send page to browser (output to requester)
How Joomla builds a page
1. loads Joomla framework, gets user session
2. determines parameters (option, etc)
3. render Component
4. determine template and module positions
5. render modules
6. assemble parts into page / output
7. send page to browser (output to requester)
How Joomla builds a page
1. loads Joomla framework, gets user session
• onAfterInitialize
2. determines parameters (option, etc)
• onAfterRoute
3. render Component
• onAfterDispatch
4. determine template and module positions
• onBeforeRender
5. render modules
• onBeforeCompileHead
6. assemble parts into page / output
• onAfterRender
7. send page to browser (output to requester)
Interspersed between
each of these steps is a
call to one of the events
that triggers the system
plugins.
Because each of these
steps represent some
completed state within the
page building process…
a system plugin can inject
additional processing at
any of these points in the
page-building process.
System Plugin Events
When a client asks for some customization, I often can accommodate with a
custom-built system plugin. Here are some example requests that can be
handle as such…
• Redirect all anonymous users to a login page
• Block a given user from accessing any page belonging to a
particular component
• Make sure only one copy of JQuery is added to the header, and
select the most recent version.
• Replace the text {current-time} with the current time – within just
the component .. anywhere within the HTML page … and time zone
or format adjusted according to user, language, or IP address
• Add ® behind each instance of a particular brand name.
• Suppress certain module positions based upon the user’s usergroup.
• Store the last five viewed shop products in a cookie so that you can
display the most recently viewed products in a module.
• Add a css file to every page.
• … more than anyone can think of …
If you understand how Joomla builds the webpage, you’ll know which event
you use to add your custom code.
System Plugin Events
1. loads Joomla framework, gets user session
• onAfterInitialize
2. determines parameters (option, etc)
• onAfterRoute
3. render Component
• onAfterDispatch
4. determine template and module positions
• onBeforeRender
5. render modules
• onBeforeCompileHead
6. assemble parts into page / output
• onAfterRender
7. send page to browser (output to requester)
plugins & plugin events
 system : as a page builds
 content: as content is created/edited/deleted
 authentication : identify user by login, LDAP,
Facebook, etc.
 user : create/manage users, react to login/logout events
 search: indexing content as it is changed
 …others…
 custom
The book to read to learn
about coding Joomla plugins
caching
-VS -
Page caching Module caching
caching
html
<head>
<body>
Page cache is the simplest and fastest.
The entire HTML for a page is retrieved
and used instead of rebuilding the page.
caching
Page : system plugin
Page Caching is a system plugin
caching
1.loads Joomla framework,
gets user session
2. determines parameters
(option, etc)
• onAfterRoute
3. render Component
4. determine template and
module positions
5. render modules
6. assemble parts into
page / output
7. send page to browser
(output to requester)
The Page Cache plugin is triggered
by onAfterRoute()
If a cached version of the page is
found, that is returned and the
plugin halts the page-building
process – saving valuable time.
caching
Sometimes part of the page is
dynamic and needs to be built
based upon the user or
something that changes often.
(Examples: user profile, a
module should display only to
a particular access level, a
twitter feed, etc.)
If a site has conditional
modules, we must cache
per module.
caching
Let’s say the events list
changes often so it’s
module should not be
cached…
caching
module
<div>…
</div>
When modules are
rendered, each module will
try to get a cached HTML
instead of investing time to
make database calls and
build the HTML. …
…However, our dynamic
module is set to never
cache (i.e., it is to render its
HTML on each page visit).
caching
1.loads Joomla framework,
gets user session
2. determines parameters
(option, etc)
3. render Component
4. determine template and
module positions
5. render modules
6. assemble parts into
page / output
7. send page to browser
(output to requester)
All 7 steps are processed,
however, caching speeds up
the results of steps 3 and 5
(which are the most costly steps
regarding time to process)
cachingcaching
4. determine template and
module positions
selects modules to render by:
• Position
• Page (menu item)
• State
• Language
• Access level
then…
5. render modules
Unlike Page caching, Module
caching still processes each
module based upon the points
in red.
Important: Module caching
accommodates a module’s
Access Level – an important
feature that will not be caught
by page caching.
caching
per Module : config and module settings In the Global Settings:
Select Conservative caching
In each module:
If a module is not to be
cached, set its cache to No
Cache. Otherwise, leave
that field set to Default so it
will be cached.
APIs and JSON
https://mysite.com/departments/data
As a true Content Management System,
Joomla allows its content to be returned
in any format. A common request is to
return content in the JSON format and
in response to an API call.
Using our knowledge as to the steps
Joomla follows in building output, let’s
think through how we can do this.
APIs and JSON
The “view” approach
has us create a sibling
view file, but with a
format of JSON instead
of HTML (view.json.php)
In that file we can do
something simple like
get the data, format it
as JSON, echo the JSON
string, then exit() from
the output-building
process.
Rather simple.
APIs and JSON
1.loads Joomla framework,
gets user session
2. determines parameters
(option, etc)
3. render Component
(done)
Here are the page-building
steps used for this approach.
APIs and JSON
Another approach is to use a system plugin.
The plugin evaluates the request implied by the
URL. If the plugin determines the URL is a valid
API request, it makes a database call to gather
the information, converts the data to JSON,
echo() the JSON string, and exit() from the
output-building process.
This actually saves us one step…
APIs and JSON
1. loads Joomla
framework, gets user
session
• onAfterInitialize
2. determines parameters
(option, etc)
• onAfterRoute
(--done--)
3. render Component
With the plugin approach, we don’t
need to add a JSON view and the
component is never called.
Review
overrides
Joomla was crafted to be very flexible.
Review
1. loads Joomla framework, gets user session
• onAfterInitialize
2. determines parameters (option, etc)
• onAfterRoute
3. render Component
• onAfterDispatch
4. determine template and module positions
• onBeforeRender
5. render modules
• onBeforeCompileHead
6. assemble parts into page / output
• onAfterRender
7. send page to browser (output to requester)
The steps Joomla uses to build a
webpage (or any other output format)
allows for…
1. Plugins, which can inject
custom processing upon the
page and its pieces
2. Caching (even module-specific)
3. Variant outputs such as RSS,
JSON, or any new format
that may emerge in the
future
How Joomla!
Builds a Web Page
implications for flexibility, plugins, cache, and special formats
Randy Carey
Careytech Studios, LLC
Careytech.com
Randy Carey
CAREYTECH.COM

Más contenido relacionado

La actualidad más candente

Overview of CMS and Joomla!
Overview of CMS and Joomla!Overview of CMS and Joomla!
Overview of CMS and Joomla!Vishwash Gaur
 
Great Responsive-ability Web Design
Great Responsive-ability Web DesignGreat Responsive-ability Web Design
Great Responsive-ability Web DesignMike Wilcox
 
A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3Darren Wood
 
Web Components v1
Web Components v1Web Components v1
Web Components v1Mike Wilcox
 
jQuery Conference Toronto
jQuery Conference TorontojQuery Conference Toronto
jQuery Conference Torontodmethvin
 
Joomla Tutorial: Joomla 2.5 a first look
Joomla Tutorial: Joomla 2.5 a first lookJoomla Tutorial: Joomla 2.5 a first look
Joomla Tutorial: Joomla 2.5 a first lookTim Plummer
 
jQuery Comes to XPages
jQuery Comes to XPagesjQuery Comes to XPages
jQuery Comes to XPagesTeamstudio
 
Introduction Yii Framework
Introduction Yii FrameworkIntroduction Yii Framework
Introduction Yii FrameworkTuan Nguyen
 
Joomla Day Chicago 2015 State of the Joomla! Union
Joomla Day Chicago 2015   State of the Joomla! UnionJoomla Day Chicago 2015   State of the Joomla! Union
Joomla Day Chicago 2015 State of the Joomla! UnionRod Martin
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesTeamstudio
 
Decoupling the Front-end with Modular CSS
Decoupling the Front-end with Modular CSSDecoupling the Front-end with Modular CSS
Decoupling the Front-end with Modular CSSJulie Cameron
 
CORNELL DRUPAL CAMP 2015: One Content Type to Rule Them All
CORNELL DRUPAL CAMP 2015: One Content Type  to Rule Them AllCORNELL DRUPAL CAMP 2015: One Content Type  to Rule Them All
CORNELL DRUPAL CAMP 2015: One Content Type to Rule Them AllWill Jackson
 
Front End Web Development Basics
Front End Web Development BasicsFront End Web Development Basics
Front End Web Development BasicsTahir Shahzad
 
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateBlog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateSean Burgess
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web ComponentsRich Bradshaw
 
JMP402 Master Class: Managed beans and XPages: Your Time Is Now
JMP402 Master Class: Managed beans and XPages: Your Time Is NowJMP402 Master Class: Managed beans and XPages: Your Time Is Now
JMP402 Master Class: Managed beans and XPages: Your Time Is NowRussell Maher
 
Forms as Structured Content
Forms as Structured Content Forms as Structured Content
Forms as Structured Content dotCMS
 

La actualidad más candente (20)

Overview of CMS and Joomla!
Overview of CMS and Joomla!Overview of CMS and Joomla!
Overview of CMS and Joomla!
 
Great Responsive-ability Web Design
Great Responsive-ability Web DesignGreat Responsive-ability Web Design
Great Responsive-ability Web Design
 
Joomla - CMS
Joomla - CMSJoomla - CMS
Joomla - CMS
 
A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3
 
Web Components v1
Web Components v1Web Components v1
Web Components v1
 
jQuery Conference Toronto
jQuery Conference TorontojQuery Conference Toronto
jQuery Conference Toronto
 
Joomla Tutorial: Joomla 2.5 a first look
Joomla Tutorial: Joomla 2.5 a first lookJoomla Tutorial: Joomla 2.5 a first look
Joomla Tutorial: Joomla 2.5 a first look
 
Web Standards
Web StandardsWeb Standards
Web Standards
 
jQuery Comes to XPages
jQuery Comes to XPagesjQuery Comes to XPages
jQuery Comes to XPages
 
Introduction Yii Framework
Introduction Yii FrameworkIntroduction Yii Framework
Introduction Yii Framework
 
Joomla Day Chicago 2015 State of the Joomla! Union
Joomla Day Chicago 2015   State of the Joomla! UnionJoomla Day Chicago 2015   State of the Joomla! Union
Joomla Day Chicago 2015 State of the Joomla! Union
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPages
 
Decoupling the Front-end with Modular CSS
Decoupling the Front-end with Modular CSSDecoupling the Front-end with Modular CSS
Decoupling the Front-end with Modular CSS
 
CORNELL DRUPAL CAMP 2015: One Content Type to Rule Them All
CORNELL DRUPAL CAMP 2015: One Content Type  to Rule Them AllCORNELL DRUPAL CAMP 2015: One Content Type  to Rule Them All
CORNELL DRUPAL CAMP 2015: One Content Type to Rule Them All
 
Front End Web Development Basics
Front End Web Development BasicsFront End Web Development Basics
Front End Web Development Basics
 
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateBlog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
 
Html5 basics
Html5 basicsHtml5 basics
Html5 basics
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web Components
 
JMP402 Master Class: Managed beans and XPages: Your Time Is Now
JMP402 Master Class: Managed beans and XPages: Your Time Is NowJMP402 Master Class: Managed beans and XPages: Your Time Is Now
JMP402 Master Class: Managed beans and XPages: Your Time Is Now
 
Forms as Structured Content
Forms as Structured Content Forms as Structured Content
Forms as Structured Content
 

Similar a How Joomla! builds a webpage (annotated)

How to Build a Website using Joomla
How to Build a Website using JoomlaHow to Build a Website using Joomla
How to Build a Website using JoomlaMamunur Rashid
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development Mage Guru
 
Template Layout Overrides - a beginner's guide
Template Layout Overrides - a beginner's guideTemplate Layout Overrides - a beginner's guide
Template Layout Overrides - a beginner's guideRuth Cheesley
 
How Browsers Work -By Tali Garsiel and Paul Irish
How Browsers Work -By Tali Garsiel and Paul IrishHow Browsers Work -By Tali Garsiel and Paul Irish
How Browsers Work -By Tali Garsiel and Paul IrishNagamurali Reddy
 
Basics of Joomla!
Basics of Joomla! Basics of Joomla!
Basics of Joomla! Saurabh Shah
 
Dita for the web: Make Adaptive Content Simple for Writers and Developer
Dita for the web: Make Adaptive Content Simple for Writers and DeveloperDita for the web: Make Adaptive Content Simple for Writers and Developer
Dita for the web: Make Adaptive Content Simple for Writers and DeveloperDon Day
 
Clean out the cobwebs.. Joomla for Libraries (Oct-2008)
Clean out the cobwebs.. Joomla for Libraries (Oct-2008)Clean out the cobwebs.. Joomla for Libraries (Oct-2008)
Clean out the cobwebs.. Joomla for Libraries (Oct-2008)Mark A. Smith
 
Template overrides austin
Template overrides   austinTemplate overrides   austin
Template overrides austinChad Windnagle
 
Introduction to whats new in css3
Introduction to whats new in css3Introduction to whats new in css3
Introduction to whats new in css3Usman Mehmood
 
Emberjs and ASP.NET
Emberjs and ASP.NETEmberjs and ASP.NET
Emberjs and ASP.NETMike Melusky
 
Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentIvan Chepurnyi
 
Joomla Modules with Permissions and Front-End Editing
Joomla Modules with Permissions and Front-End EditingJoomla Modules with Permissions and Front-End Editing
Joomla Modules with Permissions and Front-End EditingRandy Carey
 
BackboneJS Training - Giving Backbone to your applications
BackboneJS Training - Giving Backbone to your applicationsBackboneJS Training - Giving Backbone to your applications
BackboneJS Training - Giving Backbone to your applicationsJoseph Khan
 
Lotus Notes Blog Template
Lotus Notes Blog TemplateLotus Notes Blog Template
Lotus Notes Blog Templateprojectdxguy
 

Similar a How Joomla! builds a webpage (annotated) (20)

Joomla Templates101
Joomla Templates101Joomla Templates101
Joomla Templates101
 
How to Build a Website using Joomla
How to Build a Website using JoomlaHow to Build a Website using Joomla
How to Build a Website using Joomla
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development
 
Template Layout Overrides - a beginner's guide
Template Layout Overrides - a beginner's guideTemplate Layout Overrides - a beginner's guide
Template Layout Overrides - a beginner's guide
 
Template Overrides
Template  OverridesTemplate  Overrides
Template Overrides
 
Creating a basic joomla
Creating a basic joomlaCreating a basic joomla
Creating a basic joomla
 
Open Source CMS
Open Source CMSOpen Source CMS
Open Source CMS
 
How Browsers Work -By Tali Garsiel and Paul Irish
How Browsers Work -By Tali Garsiel and Paul IrishHow Browsers Work -By Tali Garsiel and Paul Irish
How Browsers Work -By Tali Garsiel and Paul Irish
 
Basics of Joomla!
Basics of Joomla! Basics of Joomla!
Basics of Joomla!
 
Dita for the web: Make Adaptive Content Simple for Writers and Developer
Dita for the web: Make Adaptive Content Simple for Writers and DeveloperDita for the web: Make Adaptive Content Simple for Writers and Developer
Dita for the web: Make Adaptive Content Simple for Writers and Developer
 
Clean out the cobwebs.. Joomla for Libraries (Oct-2008)
Clean out the cobwebs.. Joomla for Libraries (Oct-2008)Clean out the cobwebs.. Joomla for Libraries (Oct-2008)
Clean out the cobwebs.. Joomla for Libraries (Oct-2008)
 
Template overrides austin
Template overrides   austinTemplate overrides   austin
Template overrides austin
 
Introduction to whats new in css3
Introduction to whats new in css3Introduction to whats new in css3
Introduction to whats new in css3
 
Emberjs and ASP.NET
Emberjs and ASP.NETEmberjs and ASP.NET
Emberjs and ASP.NET
 
Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module development
 
Joomla Modules with Permissions and Front-End Editing
Joomla Modules with Permissions and Front-End EditingJoomla Modules with Permissions and Front-End Editing
Joomla Modules with Permissions and Front-End Editing
 
Joomla Day1
Joomla  Day1Joomla  Day1
Joomla Day1
 
BackboneJS Training - Giving Backbone to your applications
BackboneJS Training - Giving Backbone to your applicationsBackboneJS Training - Giving Backbone to your applications
BackboneJS Training - Giving Backbone to your applications
 
JOOMLA
JOOMLAJOOMLA
JOOMLA
 
Lotus Notes Blog Template
Lotus Notes Blog TemplateLotus Notes Blog Template
Lotus Notes Blog Template
 

Más de Randy Carey

Improving the CMS User Experience
Improving the CMS User Experience Improving the CMS User Experience
Improving the CMS User Experience Randy Carey
 
Site Migration and Content Strategy
Site Migration and Content StrategySite Migration and Content Strategy
Site Migration and Content StrategyRandy Carey
 
Streamlining the Client's Workflows (in Joomla)
Streamlining the Client's Workflows (in Joomla)Streamlining the Client's Workflows (in Joomla)
Streamlining the Client's Workflows (in Joomla)Randy Carey
 
The 'Client' Template - Illustrated!
The 'Client' Template - Illustrated!The 'Client' Template - Illustrated!
The 'Client' Template - Illustrated!Randy Carey
 
Improving the Client's User Experience - JAB 2012
Improving the Client's User Experience - JAB 2012Improving the Client's User Experience - JAB 2012
Improving the Client's User Experience - JAB 2012Randy Carey
 
Improving Joomla’s Backend User Experience
Improving Joomla’s Backend User ExperienceImproving Joomla’s Backend User Experience
Improving Joomla’s Backend User ExperienceRandy Carey
 

Más de Randy Carey (7)

Improving the CMS User Experience
Improving the CMS User Experience Improving the CMS User Experience
Improving the CMS User Experience
 
Site Migration and Content Strategy
Site Migration and Content StrategySite Migration and Content Strategy
Site Migration and Content Strategy
 
Streamlining the Client's Workflows (in Joomla)
Streamlining the Client's Workflows (in Joomla)Streamlining the Client's Workflows (in Joomla)
Streamlining the Client's Workflows (in Joomla)
 
The 'Client' Template - Illustrated!
The 'Client' Template - Illustrated!The 'Client' Template - Illustrated!
The 'Client' Template - Illustrated!
 
Role Based ACL
Role Based ACLRole Based ACL
Role Based ACL
 
Improving the Client's User Experience - JAB 2012
Improving the Client's User Experience - JAB 2012Improving the Client's User Experience - JAB 2012
Improving the Client's User Experience - JAB 2012
 
Improving Joomla’s Backend User Experience
Improving Joomla’s Backend User ExperienceImproving Joomla’s Backend User Experience
Improving Joomla’s Backend User Experience
 

Último

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 

Último (20)

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 

How Joomla! builds a webpage (annotated)

  • 1. How Joomla! Builds a Web Page implications for flexibility, plugins, cache, and special formats Randy Carey Careytech Studios, LLC Careytech.com
  • 3. agenda  Joomla! as a CMS  Joomla’s Flexibility  MVC  How Joomla builds a page  plugins  caching  APIs / JSON responses
  • 4. I feel Joomla is a true CMS. While it does generate websites, look deeper and you’ll see it manages content and metadata as independent of the output type (a web page, an RSS feed, JSON, etc). As a true CMS, Joomla has a process for how it takes the content and builds the output that is requested. We’ll be looking primarily at Joomla builds a webpage.
  • 5. dynamic CMS vs static The original websites were a collection of HTML files, each edited and managed by hand and per file These days a dynamic CMS separates content from formatting and the page layout. The page is build frequently so it can use the most recent versions of content and layout.
  • 6. Flexibility This diagram reflects the considerable flexibility that we get from Joomla. Let’s review each “flex point” to help us appreciate the flexibility this system buys us…
  • 7. Flexibility 1. A Modules is assigned to ONE particular position. 2. A Module is assigned to its own set of menu items (all, none, or a custom selection). … I bet you already knew that
  • 10. Flexibility3. Each template has its own set of named module positions. So … • a particular position name may exist in one template, but not in another. • Also, for any given template, the same name may occupy a different position within the layout. The example below suggests this. If we introduce multiple templates (or template styles) within our installation, we have the opportunity to introduce a lot of flexibility
  • 11. Flexibility 4. Each menu item has a dropdown field allowing you to declare which template it should use. Typically we ignore it and Default is always used. But there is nothing stopping you from setting that field so that certain menu items use a variant template. Since each template can layout the positions differently (and apply different styling), we have the potential additional flexibilities that you probably have not even thought about. … Let me show you an application of this…
  • 12. Flexibility default CTA media-room mods-only I use Gantry 5, and that framework allows me to set a different layout for each template style. (same template, different “style”) In this example, the layouts and some position names differ across templates. Consider CTA (call-to-action). If a page is set to a CTA template, that page will automatically the CTA module (a sidebar form) that I set up for the site.
  • 13. Flexibility The template/style assignment is made on the menu item. All my styles are listed as an option. In this example, I can set a page to a layout that will exclude the component.
  • 14. Flexibility overrides 5. But let’s not forget that alternative layouts (overrides) also introduce flexibility. Create multiple module templates and the user can select alternate outputs. These can vary slightly or greatly. …Flexibility accessed through a simple dropdown field.
  • 15. Flexibility overrides This diagram reflects 1, 2, 3, 4, FIVE flex-points that provide the considerable flexibility we get from Joomla’s module system.
  • 16. MVC You’ve probably heard of Joomla’s MVC. Each component has its own set. (some rogue developers try to short-circuit this, but that is another story) This is an important feature of Joomla’s architecture. We’ll just summarize…
  • 17. MVC The component’s Controller interprets the request that is implied by the URL. It then creates and launches the correct model-view objects. (example: the MVC to display an article versus the MVC to display a category list) It should be noted that each Model- View pair can have its own controller to handle view-specific tasks such as logging in a user or performing front- end editing tasks.
  • 18. MVC The Model manages the data that flows between a component and the database. It implements things like save, update, delete, as well as maintaining rules (such as returning only content that the user is allowed to access).
  • 19. MVC Each View knows its output type (HTML, RSS, etc) and orchestrates function calls accordingly. These functons could be for setting metadata or managing pagination. For an HTML page, it calls upon the appropriate template to build the HTML using the data that the model provided.
  • 20. MVC 1. execute( ) 2. display( ) 3. gets/returns data 4. injects metadata/CSS/JS, other housekeeping. 5. calls upon template to render the HTML using the data it received is created creates respective View asks its Model for data The red text below outlines the order of steps taken by a component when a webpage is being built.
  • 21. A. We’ve outlined the flexibility we have with Joomla’s module system. B. We’ve summarize what happens when a component is invoked during the page-building process. C. Now… Let’s step back and look at the steps Joomla takes as it builds a web page …. From the time it gets a URL to the time it sends the respective HTML back to the requesting browser.
  • 23. How Joomla builds a page 1. loads Joomla framework, gets user session The next slide show some of the things that get set up
  • 24. How Joomla builds a page 1. loads Joomla framework, gets user session Document Application JFactory Session PATHS: /home/public_html/… Cookies Server variables • URL parameters • language User
  • 25. How Joomla builds a page 1. loads Joomla framework, gets user session 2. determines parameters (option, etc) Every page has one and only one component. This is always implied by the URL. Joomla’s routing system parses the URL to determine the component as well as other related settings (such as view, id, or task)
  • 26. How Joomla builds a page 2. determines parameters (option, etc) option = com_content view = article id = 758 itemid = 133 task = template = format = Router Parses URL These values are obtained from parsing the URL and possibly from GET/POST values.
  • 27. How Joomla builds a page 1. loads Joomla framework, gets user session 2. determines parameters (option, etc) 3. render Component Now that we know what component to call and we have all the variables it expects, we ask the component to render itself into HTML.
  • 28. How Joomla builds a page 3. render Component Document • Rendered HTML • Title • Styles • Scripts • Metadata • Base URL (SEF) The Document object stores the HTML for this component along with other values associated to what was rendered. NOTE: Joomla is just building the pieces and storing each. It has yet to assemble them into any type of output (such as a webpage).
  • 29. How Joomla builds a page 1. loads Joomla framework, gets user session 2. determines parameters (option, etc) 3. render Component 4. determine template and module positions
  • 30. How Joomla builds a page 4. determine template and module positions Document • template HTML • template name • Styles • Scripts • Module Positions (template tags) Again, each piece is stored within the Document object. In addition to the template’s HTML, other pieces include CSS and JS declarations, as well as a list names for each module position held by the template.
  • 31. How Joomla builds a page 4. determine template and module positions Document • template HTML • template name • Styles • Scripts • Module Positions (template tags) Note: Only those position names found within the template are stored. When Joomla renders the modules, it will consider only those modules belonging to a position within the template. Consider the “component” template that is meant to display just the component but no modules: It contains no module positons.
  • 32. How Joomla builds a page 4. determine template and module positions Document • template HTML • template name • Styles • Scripts • Module Positions (template tags) only if format is HTML If the format is to be RSS, JSON, or something other than HTML (a webpage), then there is no need to process a template.
  • 33. How Joomla builds a page 1. loads Joomla framework, gets user session 2. determines parameters (option, etc) 3. render Component 4. determine template and module positions 5. render modules
  • 34. How Joomla builds a page 5. render modules For each module position to be processed, Joomla queries the database for those modules. In addition to module position, the query also limits results to the current menu item, the current language, the current access level, and a state of published. Each module returned by the database is rendered individually…
  • 35. How Joomla builds a page 5. render modules Document • modules HTML For each module: • HTML • Styles • Scripts Each module’s HTML is stored in the Document. If a module includes a dependency upon a CSS or JS file, that reference is added to the Document. What happens if the same CSS or JS is included by multiple modules? …
  • 36. How Joomla builds a page 5. render modules Document • modules HTML For each module: • HTML • Styles • Scripts What happens if the same CSS or JS is included by multiple modules? No problem. The document will keep only one reference to a file if duplicates are added during the page-building process.
  • 37. How Joomla builds a page 1. loads Joomla framework, gets user session 2. determines parameters (option, etc) 3. render Component 4. determine template and module positions 5. render modules 6. assemble parts into page / output At this point we have all the HTML pieces, metadata, and JSS/CSS references collected. Time to let Joomla assemble all these parts into the page according to the template.
  • 38. How Joomla builds a page Document • Styles • Scripts • Metadata The document is holding all the parts. Time to assemble them into the output (in our case, a webpage)
  • 39. How Joomla builds a page 6. assemble parts into page / output • page HTML
  • 40. How Joomla builds a page 6. assemble parts into page / output • page HTML if page is not cached If page-caching is on and the page was cached… the page-building process concluded a few steps back – we would never reached this point.
  • 41. How Joomla builds a page 1. loads Joomla framework, gets user session 2. determines parameters (option, etc) 3. render Component 4. determine template and module positions 5. render modules 6. assemble parts into page / output 7. send page to browser (output to requester)
  • 42. How Joomla builds a page 1. loads Joomla framework, gets user session 2. determines parameters (option, etc) 3. render Component 4. determine template and module positions 5. render modules 6. assemble parts into page / output 7. send page to browser (output to requester)
  • 43. How Joomla builds a page 1. loads Joomla framework, gets user session • onAfterInitialize 2. determines parameters (option, etc) • onAfterRoute 3. render Component • onAfterDispatch 4. determine template and module positions • onBeforeRender 5. render modules • onBeforeCompileHead 6. assemble parts into page / output • onAfterRender 7. send page to browser (output to requester) Interspersed between each of these steps is a call to one of the events that triggers the system plugins. Because each of these steps represent some completed state within the page building process… a system plugin can inject additional processing at any of these points in the page-building process.
  • 44. System Plugin Events When a client asks for some customization, I often can accommodate with a custom-built system plugin. Here are some example requests that can be handle as such… • Redirect all anonymous users to a login page • Block a given user from accessing any page belonging to a particular component • Make sure only one copy of JQuery is added to the header, and select the most recent version. • Replace the text {current-time} with the current time – within just the component .. anywhere within the HTML page … and time zone or format adjusted according to user, language, or IP address • Add ® behind each instance of a particular brand name. • Suppress certain module positions based upon the user’s usergroup. • Store the last five viewed shop products in a cookie so that you can display the most recently viewed products in a module. • Add a css file to every page. • … more than anyone can think of … If you understand how Joomla builds the webpage, you’ll know which event you use to add your custom code.
  • 45. System Plugin Events 1. loads Joomla framework, gets user session • onAfterInitialize 2. determines parameters (option, etc) • onAfterRoute 3. render Component • onAfterDispatch 4. determine template and module positions • onBeforeRender 5. render modules • onBeforeCompileHead 6. assemble parts into page / output • onAfterRender 7. send page to browser (output to requester)
  • 46. plugins & plugin events  system : as a page builds  content: as content is created/edited/deleted  authentication : identify user by login, LDAP, Facebook, etc.  user : create/manage users, react to login/logout events  search: indexing content as it is changed  …others…  custom The book to read to learn about coding Joomla plugins
  • 47. caching -VS - Page caching Module caching
  • 48. caching html <head> <body> Page cache is the simplest and fastest. The entire HTML for a page is retrieved and used instead of rebuilding the page.
  • 49. caching Page : system plugin Page Caching is a system plugin
  • 50. caching 1.loads Joomla framework, gets user session 2. determines parameters (option, etc) • onAfterRoute 3. render Component 4. determine template and module positions 5. render modules 6. assemble parts into page / output 7. send page to browser (output to requester) The Page Cache plugin is triggered by onAfterRoute() If a cached version of the page is found, that is returned and the plugin halts the page-building process – saving valuable time.
  • 51. caching Sometimes part of the page is dynamic and needs to be built based upon the user or something that changes often. (Examples: user profile, a module should display only to a particular access level, a twitter feed, etc.) If a site has conditional modules, we must cache per module.
  • 52. caching Let’s say the events list changes often so it’s module should not be cached…
  • 53. caching module <div>… </div> When modules are rendered, each module will try to get a cached HTML instead of investing time to make database calls and build the HTML. … …However, our dynamic module is set to never cache (i.e., it is to render its HTML on each page visit).
  • 54. caching 1.loads Joomla framework, gets user session 2. determines parameters (option, etc) 3. render Component 4. determine template and module positions 5. render modules 6. assemble parts into page / output 7. send page to browser (output to requester) All 7 steps are processed, however, caching speeds up the results of steps 3 and 5 (which are the most costly steps regarding time to process)
  • 55. cachingcaching 4. determine template and module positions selects modules to render by: • Position • Page (menu item) • State • Language • Access level then… 5. render modules Unlike Page caching, Module caching still processes each module based upon the points in red. Important: Module caching accommodates a module’s Access Level – an important feature that will not be caught by page caching.
  • 56. caching per Module : config and module settings In the Global Settings: Select Conservative caching In each module: If a module is not to be cached, set its cache to No Cache. Otherwise, leave that field set to Default so it will be cached.
  • 57. APIs and JSON https://mysite.com/departments/data As a true Content Management System, Joomla allows its content to be returned in any format. A common request is to return content in the JSON format and in response to an API call. Using our knowledge as to the steps Joomla follows in building output, let’s think through how we can do this.
  • 58. APIs and JSON The “view” approach has us create a sibling view file, but with a format of JSON instead of HTML (view.json.php) In that file we can do something simple like get the data, format it as JSON, echo the JSON string, then exit() from the output-building process. Rather simple.
  • 59. APIs and JSON 1.loads Joomla framework, gets user session 2. determines parameters (option, etc) 3. render Component (done) Here are the page-building steps used for this approach.
  • 60. APIs and JSON Another approach is to use a system plugin. The plugin evaluates the request implied by the URL. If the plugin determines the URL is a valid API request, it makes a database call to gather the information, converts the data to JSON, echo() the JSON string, and exit() from the output-building process. This actually saves us one step…
  • 61. APIs and JSON 1. loads Joomla framework, gets user session • onAfterInitialize 2. determines parameters (option, etc) • onAfterRoute (--done--) 3. render Component With the plugin approach, we don’t need to add a JSON view and the component is never called.
  • 62. Review overrides Joomla was crafted to be very flexible.
  • 63. Review 1. loads Joomla framework, gets user session • onAfterInitialize 2. determines parameters (option, etc) • onAfterRoute 3. render Component • onAfterDispatch 4. determine template and module positions • onBeforeRender 5. render modules • onBeforeCompileHead 6. assemble parts into page / output • onAfterRender 7. send page to browser (output to requester) The steps Joomla uses to build a webpage (or any other output format) allows for… 1. Plugins, which can inject custom processing upon the page and its pieces 2. Caching (even module-specific) 3. Variant outputs such as RSS, JSON, or any new format that may emerge in the future
  • 64. How Joomla! Builds a Web Page implications for flexibility, plugins, cache, and special formats Randy Carey Careytech Studios, LLC Careytech.com

Notas del editor

  1. Imagine Joomla websites where those charged with maintaining it are able to edit modules on the front-end. Let me show you what it is like, and let me share some of the issues to be aware of as we provide this ability to our clients.
  2. Today I focus my business .. On building sites with significant customization
  3. …not a “how you build a site with Joomla rather… How Joomla works behind the site you build. Value: know what Joomla can do, and what you can do with Joomla
  4. I invest time in Joomla Build component and studied code, Read Practiced Read challenges on forum and sought to solve them
  5. No HTML file per page Content assembled per page request
  6. …let’s start with the module
  7. …let’s start with the module
  8. Position assignment by name spelling
  9. Look at events module – menu item assignment
  10. …let’s start with the module
  11. …let’s start with the module
  12. : what I’m doing …demo Gantry layouts : benefits, how to with std template
  13. My example Note: shows all templates
  14. position – by name spelling. Template: its own layouts with named positions
  15. position – by name spelling. Template: its own layouts with named positions
  16. Controller: may parse/delegate tasks View may be of different formats Model: handles SQL, access levels, filtering
  17. Controller: may parse/delegate tasks View may be of different formats Model: handles SQL, access levels, filtering
  18. Controller: may parse/delegate tasks View may be of different formats Model: handles SQL, access levels, filtering
  19. Controller: may parse/delegate tasks View may be of different formats Model: handles SQL, access levels, filtering
  20. Controller: may parse/delegate tasks View may be of different formats Model: handles SQL, access levels, filtering
  21. custom menu items
  22. GET/POST variables (option, view, task, id, itemid, etc)
  23. GET/POST variables (option, view, task, id, itemid, etc)
  24. Buffer[0] is html of component Add: component-level scripts and styles Set metadata Set base URL
  25. Buffer[0] is html of component Add: component-level scripts and styles Set metadata Set base URL
  26. Module selection We know page’s menu item ->template -> each module position Also: state, access and language
  27. We know page’s menu item (item id) and each module position on the template So we need to know template before rendering modules
  28. We know page’s menu item (item id) and each module position on the template So we need to know template before rendering modules
  29. We know page’s menu item (item id) and each module position on the template So we need to know template before rendering modules
  30. Content that changes – frequently, or per user Frequently – want changes instantly Feeds (Twitter) User specific content (login, profile)
  31. But what if some content changes needs to be updated immediately, or varies per user Frequently – want changes instantly Feeds (Twitter) User specific content (login, profile)
  32. But what if some content changes needs to be updated immediately, or varies per user Frequently – want changes instantly Feeds (Twitter) User specific content (login, profile)
  33. Content that changes – frequently, or per user Frequently – want changes instantly Feeds (Twitter) User specific content (login, profile)
  34. Need all steps of building a page. Savings – cached module & component html (instead of building) Modules that need to be rendered know it and render instead of getting cached copy
  35. No need to exclude a module from cache if it varies only by whether or not it is to display. That is handled before render modules
  36. Global config On module
  37. View of a special type. API examples: inventory, sales, users,…
  38. View of a special type.
  39. Imagine Joomla websites where those charged with maintaining it are able to edit modules on the front-end. Let me show you what it is like, and let me share some of the issues to be aware of as we provide this ability to our clients.