This talk gives an overview of Deliverance, a middleware tool that makes it easy to theme any website. In particular, we discuss how to make it work with the Plone, open source CMS.
2. Slides to add
• if-content
• used to match certain templates
• proxy to live site
• jquery.com example - show theme=
• how to handle theming of elements inside the
HTML that Plone generates in the static theme
• does the XML file need to be well-formed?
what about the HTML? does it need to be valid
XHTML.
• can Plone's authoring interface be themed to
look like the Deliverance-themed site?
jazkarta
4. Theming in Plone
an exercise in patience
• Install dependencies (Python, XCode, GCC)
• Create a theme egg using paster
• Put your stylesheets and images in /browser
• But override Plone assets in /skins
• To turn off viewlets, must edit configure.zcml
• To make new viewlets must code Python
• Must learn ZPT to edit page templates
jazkarta
7. What is Deliverance?
• Middleware tool that serves as a proxy
• Maps content HTML into design HTML
• Keeps presentation separate from content
jazkarta
25. Deliverance benefits
• web designer doesn't need to learn CMS templating
• separation of concerns
• theme multiple apps with one design
(trac, wiki, blog, etc.)
jazkarta
28. Who is using Deliverance?
• plone.org
• plone.tv
jazkarta
29. Who is using Deliverance?
• plone.org
• plone.tv
• Harvard School of Engineering (subsites)
jazkarta
30. Who is using Deliverance?
• plone.org
• plone.tv
• Harvard School of Engineering (subsites)
• ploneconf2009.org (get the buildout!)
jazkarta
31. Who is using Deliverance?
• plone.org
• plone.tv
• Harvard School of Engineering (subsites)
• ploneconf2009.org (get the buildout!)
• repoze.org (multi-app theming)
jazkarta
32. Who is using Deliverance?
• plone.org
• plone.tv
• Harvard School of Engineering (subsites)
• ploneconf2009.org (get the buildout!)
• repoze.org (multi-app theming)
• and many others...
jazkarta
39. "Replace our custom backend with Plone CMS."
HaiVision
"Sure, we can do that."
Jazkarta
jazkarta
40. "Replace our custom backend with Plone CMS."
HaiVision
"Sure, we can do that."
Jazkarta
"Keep the frontend design the same."
HaiVision
jazkarta
41. "Replace our custom backend with Plone CMS."
HaiVision
"Sure, we can do that."
Jazkarta
"Keep the frontend design the same."
HaiVision
"No problem."
Jazkarta
jazkarta
42. "Replace our custom backend with Plone CMS."
HaiVision
"Sure, we can do that."
Jazkarta
"Keep the frontend design the same."
HaiVision
"No problem."
Jazkarta
"We're going to change the design soon, and
we want to be able to change the HTML/CSS
HaiVision
ourselves."
jazkarta
43. "Replace our custom backend with Plone CMS."
HaiVision
"Sure, we can do that."
Jazkarta
"Keep the frontend design the same."
HaiVision
"No problem."
Jazkarta
"We're going to change the design soon, and
we want to be able to change the HTML/CSS
HaiVision
ourselves."
"Umm. Ok, you will be able to do that."
Jazkarta
jazkarta
44. Customers
change their
mind about
their identity
all the time.
Don't make it painful than
it already is for them.
45. "Oh, and we need this done
HaiVision in two weeks."
Jazkarta
46. "Oh, and we need this done
HaiVision in two weeks."
"WTF!?" Jazkarta
48. Why Deliverance?
• They have three different sections of the
site, each needing to be themed differently.
• They want to change the design, but their
staff only knows HTML/CSS.
• They might want to theme another web
app to have the same look-n-feel as their
website.
• Oh, and they want this done ASAP.
jazkarta
49. Why not a Plone theme?
• Significant man hours to make a pixel perfect Plone
theme
• Difficult to apply a different theme for different
sections of the site
• The customer should not have to learn Plone
theming technology to make design changes.
• One less piece of software that we have to maintain
• Difficult to upgrade to newer versions of Plone
when there are many theme customizations
jazkarta
51. Seven Steps to Heaven
1. Check out and run the Deliverance demo buildout
jazkarta
52. Seven Steps to Heaven
1. Check out and run the Deliverance demo buildout
2. Prepare your HTML/CSS files (might need to do
some cleanup)
jazkarta
53. Seven Steps to Heaven
1. Check out and run the Deliverance demo buildout
2. Prepare your HTML/CSS files (might need to do
some cleanup)
3. Stick the files in a /static folder in buildout dir
jazkarta
55. 4. Identify the CSS selectors of the elements in the
Plone site that we wish to map to the static
theme.
jazkarta
56. 4. Identify the CSS selectors of the elements in the
Plone site that we wish to map to the static
theme.
5. Identify the CSS selectors in the static theme that
should serve as placeholders for the dynamic
content coming from Plone.
jazkarta
57. 4. Identify the CSS selectors of the elements in the
Plone site that we wish to map to the static
theme.
5. Identify the CSS selectors in the static theme that
should serve as placeholders for the dynamic
content coming from Plone.
6. Create a rules file that maps Plone content
elements to placeholder elements in the theme
jazkarta
58. 4. Identify the CSS selectors of the elements in the
Plone site that we wish to map to the static
theme.
5. Identify the CSS selectors in the static theme that
should serve as placeholders for the dynamic
content coming from Plone.
6. Create a rules file that maps Plone content
elements to placeholder elements in the theme
7. Set up an Apache vhost to proxy to Deliverance
jazkarta
60. 1. Check out and run
the demo buildout
svn co http://svn.plone.org/svn/collective/deliverancedemo/trunk/ dd
Run the bootstrap command and run the buildout
cd dd
python bootstrap.py
bin/buildout -v
This will install Deliverance and it's dependencies (lxml)
and install a Plone site at /Plone
jazkarta
61. 2. Prepare your HTML/CSS
• An HTML/CSS template that you downloaded
from somewhere
• Design assets that were given to you by a
customer, design agency or your designer
• A design from an existing website
jazkarta
63. 3. Stick them in a /static
dir in your buildout
jazkarta
64. 3. Stick them in a /static
dir in your buildout
jazkarta
65. 4. Identify elements in
Plone to map to design
• Firebug is your friend (www.getfirebug.com)
• Click on elements to get their class or id
• Can also get XPath expression by right-
clicking on element
jazkarta
68. 5. Identify the corresponding
element in the theme
• You may need to add a class or ID to better
identify the element.
• You can use an absolute path to the element in
the DOM, but if the element gets moved, the
mapping rule will not work anymore.
• So it's best to always use a class or ID to avoid
breakage.
jazkarta
73. The "plone" rule class
<rule class="plone">
<!-- Theme -->
<theme href="/static/index.html" />
<!-- Put your rules below this line -->
</rule>
</ruleset>
jazkarta
77. 6. Insert our rule into the
rules-training.xml file
<rule class="plone">
<!-- Theme -->
<theme href="/static/index.html" />
<!-- Put your rules below this line -->
<replace content='children:h1.documentFirstHeading'
theme='children:span.sectionTitle' />
</rule>
</ruleset>
jazkarta
78. Let's start up Zope and
the Deliverance proxy
$ cd dd
$ bin/instance start
. . daemon process started, pid=3556
$ bin/deliverance-proxy rules-training.xml
To see logging, visit http://127.0.0.1:5000/.deliverance/login
after login go to http://127.0.0.1:5000/?deliv_log
serving on http://127.0.0.1:5000
jazkarta
90. Replace navigation tree
<drop content='.portletNavigationTree dt.portletHeader' />
<drop content='li.navTreeItem img' />
<replace content="dl.portletNavigationTree"
theme="children:#left-navigation" />
Must place drop rules before replace rule.
100. Each page class can have
a separate theme & rules
<rule class="applications" suppress-standard="1">
<theme href="/static/applications.html" />
<replace content='children:p.documentDescription'
theme='children:span.SectionSubtitle' />
<replace content='children:#portal-column-two'
theme='children:#right-column' />
</rule>
jazkarta
109. How do I deploy Deliverance
into production?
• Run as a proxy on port 5000. Apache or
Nginx proxies to port 5000.
• two separate python processes
• Run as WSGI middleware.
• only one python process running
jazkarta
112. 7. Make the Apache vhost
<VirtualHost *:80>
ServerName www.haivision.com
ProxyPreserveHost On
RewriteEngine On
RewriteRule ^/(.*) http://127.0.0.1:5000/$1 [L,P]
</VirtualHost>
The ProxyPreserveHost is very important.
jazkarta
113. What about
performance?
• Deliverance respects caching headers
• Pages load fast because they don't have to
load all of Plone's assets
• Deliverance runs in small memory footprint
and takes hardly any server resources
jazkarta
115. How is Deliverance
better than xdv?
• Has a dedicated maintainer
jazkarta
116. How is Deliverance
better than xdv?
• Has a dedicated maintainer
• Use CSS selectors instead of only XPath
jazkarta
117. How is Deliverance
better than xdv?
• Has a dedicated maintainer
• Use CSS selectors instead of only XPath
• Can combine multiple themes without Apache magic
jazkarta
118. More Deliverance advantages
• Serves static resources directly from the file system.
No need to make a skin or serve from Apache.
• Deliverance has a very useful debugging console
• Deliverance lets you edit files through-the-web
jazkarta
137. Banjo sprint this wkend?
• jQuery help needed
• Python programmers wanted
• User interface gurus
Put your name on the interest list at:
http://www.coactivate.org/projects/banjo/plone-conference-banjo-sprint
jazkarta
One of the first things people want to do with their web site is change the look-n-feel. Unfortunately, with Plone this is a time consuming and frustrating experience for most people.
If you've ever tried to theme a Plone site, you know that there are a lot of concepts to wrap your head around before you start seeing results. The learning curve is simply to steep for most people.
Poll the audience to see who represents each role.
Poll the audience to see who represents each role.
Poll the audience to see who represents each role.
Poll the audience to see who represents each role.
If you know this one from XKCD, it says "You're flying! How?" and the guy up in the sky says, "Python!"
plone.org is actually using xdv, but same underlying technology
plone.tv was one of the first sites to adopt it in production (currently down), SEAS was our first customer project.
plone.org is actually using xdv, but same underlying technology
plone.tv was one of the first sites to adopt it in production (currently down), SEAS was our first customer project.
plone.org is actually using xdv, but same underlying technology
plone.tv was one of the first sites to adopt it in production (currently down), SEAS was our first customer project.
plone.org is actually using xdv, but same underlying technology
plone.tv was one of the first sites to adopt it in production (currently down), SEAS was our first customer project.
plone.org is actually using xdv, but same underlying technology
plone.tv was one of the first sites to adopt it in production (currently down), SEAS was our first customer project.
plone.org is actually using xdv, but same underlying technology
plone.tv was one of the first sites to adopt it in production (currently down), SEAS was our first customer project.
HaiVision approached us and said that they wanted to use Plone as the CMS for their website, that was currently powered by an inflexible custom Cold Fusion app.
Significant # of man hours required to make a pixel perfect theme that fits within Plone's templating structure.
After 2) we did some clean-up of the HTML, mostly changing the GIF images that were used as navigation to text. 3) Obviously need to run buildout to build Deliverance and its dependencies.
After 2) we did some clean-up of the HTML, mostly changing the GIF images that were used as navigation to text. 3) Obviously need to run buildout to build Deliverance and its dependencies.
After 2) we did some clean-up of the HTML, mostly changing the GIF images that were used as navigation to text. 3) Obviously need to run buildout to build Deliverance and its dependencies.
For those of you who like to follow along, now you can fire up your terminal and do some Deliverance theming.
Rename to index.html and images. Change all references to "products_files" in index.html to "images"
The only thing dynamic on this page is the news box. Every thing else is static that the customer manages in the HTML.