These are the slides from my presentation at the Joomla World Conference, held in San Jose in November 2012. Video of presentation is available: Save Time and Money by Using ACP for Joomla Content http://torontojoomla.ca/blog/13-save-time-and-money-by-using-acp-with-joomla-content
2. How We Use ACP
●
What problems does ACP solve
●
What is a pattern
●
Walk through a few examples
●
Questions
3. About Me
● Active in FOSS since mid-1990's
● Involved with Joomla since 2006
● Founding member of Joomla Security Team
● Project structure WG
● Working on Joomla 4.0 architecture
● Former development team and JBS member
● Pioneered unit testing in Joomla core
● Contributor to PHP's PEAR
● Founded Abivia Web Hosting and Development in 2005
4. What is ACP?
Abivia Content Pattern Plugin
A plugin for content that
separates data Data
from presentation
5. What is a Pattern?
Template
Clone to Article
User Data
Final Article
6. Data + Pattern = Page Content
Article Final Article
Patterns
Pattern Reference
Resolved Pattern
with Data
ACP
(Runs during
Pattern Reference Page Composition) Resolved Pattern
with Data
11. What Does ACP Fix?
I liked it better
with a bigger
image I know
kittens don't
really go with
the rest of the
site but these
Unwa
ones are so
nted
cute I thought it
p
would be okay resenta
if we did it just tion chan
ges b
this one time
y huma
don't you think n edi
they're cute my tors
partner also
thinks it would
be nice to put
up a picture of
his dog rex and
12. Advantages of Patterns
Pattern
● Applied during page composition
● Presentation changes have instant effect
● A pattern is just another article
Template
● One time substitution when article added
● Presentation elements are “baked in”
● Users can make unwanted changes to presentation
elements
13. Why “pattern”
● Template is an over used that has too many
meanings:
– Joomla Templates
– Content Templater from NoNumber.nl
– Other content template solutions
– Stand-alone template systems
– Template systems built into other extensions
17. ACP Evolved
ACP has evolved considerably
●
Version 2.0
●
Language features
●
On the fly CSS injection
●
Format-specific patterns (html, feed, raw)
●
Access to Joomla environment
18. Basic ACP Example
Article Biography Pattern
{acp _pattern biography} <div>
{name Jane Doe} <h3>{acp var name}
{title CEO} {acp ifdef title}
{body/} , <em>{acp var title}</em>
one or more paragraphs here {acp end title}
{/body} </h3>
{acp _end} {acp var body}
</div>
19. Basic ACP Example
Article Biography HTML
{acp _pattern biography} <div>
{name Jane Doe} <h3>Jane Doe,
<em>CEO</em></h3>
{title CEO}
one or more paragraphs here
{body/}
</div>
one or more paragraphs here
{/body}
{acp _end}
20. ACP as a Content Creator
Objective: keep it simple
{acp _command parameters}
definition/selection directives
{acp _end}
Top Level Commands are:
_pattern, _globals, _with
22. Arrays and Objects? Really??
Useful in many real world situations:
– Business Directory
●
Office [1..n]
– Address
– Staff [1..n]
●
Name, title, email, phone, [cell], [fax], etc.
User friendly commands: _list, _open
instead of _array, _object
23. Globals
●
Globals are available to all pattern references
{acp _globals}
definitions
{acp _end}
24. Example of Globals
{acp _globals}
{path /some/file/path/}
{acp _end}
{acp _pattern image}{name x.jpg}{acp _end}
{acp _pattern image}{name y.jpg}{acp _end}
The path variable is available to both calls to the
image pattern.
25. The Power of _”With”
●
With selects articles, then applies a pattern
●
Only article globals are available
●
Surprisingly powerful feature
{acp _with pattern}
{article alias or id...}
{category catalias or catid...}
{acp _end}
26. Processing in a With Command
Final Article
Pattern
Master Article Resolved Article
Pattern Reference
with
Article Selectors Resolved Article
ACP
Resolved Article
Selected
Selected
Selected
Selected
Selected
Articles
Articles
Articles
Resolved Article
Articles
Articles
ACP Globals
ACP Globals
ACP Globals
ACP Globals
ACP Globals
Resolved Article
27. ACP as a Developer
ACP has a rich command set
●
Variable spaces: var, article, request, with
●
Conditionals: if, ifdef, ifempty, ifview
●
Looping: for, foreach
●
Styles: css
●
More: set, transform, ...
31. Example: Case Studies
Global Variables:
●
date
●
description
●
equity
●
fund
●
industry
●
overview
●
own
●
role
●
status (optional)
●
thesis
32. Example: Bizcase Pattern
<div class="biz-case">
<div class="biz-data">
<p><strong>Sector:</strong> {acp var industry}</p>
<p><strong>Investment Date:</strong> {acp var date}</p>
<p><strong>Equity:</strong> {acp var equity}</p>
{acp ifdef status}<p><strong>Status:</strong> {acp var status}</p>{acp end status}
<p><strong>{acp var fund} Ownership:</strong> {acp var own}</p>
</div>
<div class="biz-body">
<h4>{acp var @with.title}</h4>
<h5>Company Overview:</h5>
{acp var overview}
<h5>Transaction Description:</h5>
{acp var description}
<h5>CFI Role:</h5>
{acp var role}
<h5>Investment Thesis:</h5>
Editor Switcher by
{acp var thesis}
Anything Digital
</div>
</div>
33. Example: Case Studies
Doing it with style: On-t
he-fl
y CS
S Ch
{acp css} ange
s
.biz-body {max-width: 725px;padding-left: 1em;}
div.biz-case {border-top: 3px solid #ef3318;clear:
both;margin-bottom: 24px;}
div.biz-data {background:
url(/images/sections/cs/cs_head_400x260.jpg) no-repeat top
right transparent;min-height: 170px;}
div.biz-data p {margin: 0 16px 8px 24px;}
{acp end}
36. Example: Multiple Presentations
{acp _globals}
{jext plg_abiviasupertable}
{j15 1} {j25 1}
{fptitle SuperTable Plugin}
{fpsub Beautiful tables in less than a minute!}
{fptext Abivia's SuperTable Plugin is designed to make your tabular
data pop! SuperTable takes regular tabular data and turns it into a
powerful and dynamic display.}
{acp _end}
Remaining article content...
37. Example: Multiple Presentations
Extension Thumbnail
<a href="{acp var @with.url}">
<img class="jthumb"
src="images/{acp var jext}/thumb.png"
alt="{acp @with.title}"/>
</a>
38. Example: Multiple Presentations
Blog Title
<h3><a href="{siteacp var @with.url}">
{acp ifdef fptitle}
{acp var fptitle}
{acp else fptitle}
{acp var @with.title}
{acp end fptitle}</a>
{acp ifdef new} <span class="new">NEW!</span>{acp end new}
</h3>
39. Example: Multiple Presentations
Version buttons
{acp ifdef j25}
<a href="{acp var @with.url}"><img class="jbutton"
src="images/buttons/btn-joomla-25.png" alt="Designed for
Joomla 2.5" title="Designed for Joomla 2.5"/></a>
{acp end j25}
40. ACP Development & Support
●
ACP 2.0 just released (free for now)
●
Runs on J 1.5, 2.5 expect 3.0 soon
●
ACP 1.9 has been used in production > 1 year
●
Code quality:
●
53 unit tests – so far
●
Documentation:
●
29 page reference manual (with a few examples)
●
Not much tutorial support yet
●
Forums
41. ACP Future Development
●
More capable expressions (comparison, math)
●
Add LESS for Joomla 3.0
●
Patterns in XML
●
More “with” selectors
●
Schemas for pattern data
●
Graphical Interface / Editor Assist
42. Questions
?
Credits:
Kitten image: goosie-gander (Flickr) used under a CC license.
Clip art: openclipart.org public domain license
Image editing: Gimp.org (GPLv3)
Presentation: LibreOffice.org (LGPLv3)
43. Contact Information
Alan Langford u!
Thank yo
jal@php.net
alan.langford@abivia.com
www.abivia.net
Twitter: @FxNxRL, @Abivia
ADN: @yyz
Skype: abivia.com
also Google+, Facebook, LinkedIn...