<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>TAKA DESIGNS » Plone</title>
	
	<link>http://www.takadesigns.com/blog</link>
	<description>Mike Takahashi</description>
	<lastBuildDate>Tue, 31 Jan 2012 05:18:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/takadesigns_plone" /><feedburner:info uri="takadesigns_plone" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Replacing attributes from Plone in your XDV theme</title>
		<link>http://feedproxy.google.com/~r/takadesigns_plone/~3/1Eici2RJjFg/</link>
		<comments>http://www.takadesigns.com/blog/2010/10/27/replacing-attributes-from-plone-in-your-xdv-theme/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 14:58:20 +0000</pubDate>
		<dc:creator>Mike Takahashi</dc:creator>
				<category><![CDATA[Plone]]></category>

		<guid isPermaLink="false">http://www.takadesigns.com/blog/?p=1400</guid>
		<description><![CDATA[Tweet A few months ago at the Plone West Coast Sprint we started to work on a few new themes for Plone using XDV and came upon a road block:  How do you replace attributes within elements in XDV? We wanted to replace the href tag in the logo of our theme: &#60;div id="logo"&#62; &#60;a [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton1400" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fbit.ly%2FqI3yv3&amp;via=takadesigns&amp;text=Replacing%20attributes%20from%20Plone%20in%20your%20XDV%20theme&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.takadesigns.com%2Fblog%2F2010%2F10%2F27%2Freplacing-attributes-from-plone-in-your-xdv-theme%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.takadesigns.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div> 
<span class = "facebook-like" style = "height: 45px;  "><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.takadesigns.com/blog/2010/10/27/replacing-attributes-from-plone-in-your-xdv-theme/&layout=button_count&send=false&show_faces=false&width=500&action=recommend&colorscheme=light&font=" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:500px; height:45px"></iframe></span><p>A few months ago at the <a href="http://laplone.org/sprints/west-coast-sprint-2010">Plone West Coast Sprint</a> we started to <a href="http://plonechix.blogspot.com/2010/09/la-theme-sprint-report.html">work on a few new themes for Plone using XDV</a> and came upon a road block:  How do you replace attributes within elements in <a href="http://plone.org/products/collective.xdv">XDV</a>?</p>
<p><span id="more-1400"></span></p>
<p>We wanted to replace the <span class="source-code">href</span> tag in the logo of our theme:</p>
<pre>&lt;div id="logo"&gt;
  &lt;a <strong>href="#"</strong>&gt;
     &lt;img src="logo.png" alt="" title="Plone Theme" height="57" width="252" /&gt;&lt;/a&gt;
&lt;/div&gt;</pre>
<p>with the <span class="source-code">href</span> tag Plone dynamically generates in <span class="source-code">&#8220;portal-logo&#8221;</span>:</p>
<pre>&lt;a id="portal-logo" accesskey="1" <strong>href="http://yourplonesite.com"</strong>&gt;
  &lt;img src="http://yourplonesite.com/logo.jpg"
       alt="" title="Plone" height="57" width="252" /&gt;&lt;/a&gt;</pre>
<p>Should be pretty simple, right?  Just use the <a href="http://plone.org/documentation/kb/advanced-xdv-theming/xdv-rules"><span class="source-code">&lt;replace&gt;</span></a> rule in our <a href="http://plone.org/products/collective.xdv/documentation/reference-manual/theming/quick-start/the-rule-file"><span class="source-code">rules.xml</span></a> file and specify the <span class="source-code">href</span> attribute as follows:</p>
<pre>&lt;replace content="//*[@id="portal-logo"]/@href" theme="//*[@id="logo"]/a"/&gt;</pre>
<p>WRONG. For some reason, you need to use the <span class="source-code">&lt;prepend&gt;</span> rule:</p>
<pre>&lt;prepend content="//*[@id="portal-logo"]/@href" theme="//*[@id="logo"]/a"/&gt;</pre>
<p>Normally, <span class="source-code">&lt;prepend&gt;</span> copies specified elements from Plone as the very first child of an element in the theme. What we found is that this is apparently only true with elements. For some reason, when the selecting attributes, XDV alters the behavior of <span class="source-code">&lt;prepend&gt;</span> and it acts like <span class="source-code">&lt;replace&gt;</span>.</p>
<p>Here&#8217;s what the output of the theme should look like with the correct XDV rule applied:</p>
<pre>&lt;div id="logo"&gt;
  &lt;a href="http://yourplonesite.com"&gt;
  &lt;img src="logo.png" alt="" title="Plone Theme" height="57" width="252" /&gt;&lt;/a&gt;
&lt;/div&gt;</pre>
<img src="http://feeds.feedburner.com/~r/takadesigns_plone/~4/1Eici2RJjFg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.takadesigns.com/blog/2010/10/27/replacing-attributes-from-plone-in-your-xdv-theme/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.takadesigns.com/blog/2010/10/27/replacing-attributes-from-plone-in-your-xdv-theme/</feedburner:origLink></item>
		<item>
		<title>Quick Guide: Creating a Plone 3 theme product on the file system</title>
		<link>http://feedproxy.google.com/~r/takadesigns_plone/~3/NKDOixkkRwE/</link>
		<comments>http://www.takadesigns.com/blog/2010/07/28/creating-a-plone-3-theme-product-on-the-file-system/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 15:30:54 +0000</pubDate>
		<dc:creator>Mike Takahashi</dc:creator>
				<category><![CDATA[Plone]]></category>

		<guid isPermaLink="false">http://www.takadesigns.com/blog/?p=1025</guid>
		<description><![CDATA[Tweet Creating a Plone 3 theme product on the file system can be notoriously daunting for beginners. A lot of documentation exists, but it is somewhat fragmented and can be confusing. I&#8217;ve been designing and skinning themes for Plone for quite sometime now and thought it would be nice to have a quick guide on [...]]]></description>
			<content:encoded><![CDATA[<div id="tweetbutton1025" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fbit.ly%2Frsa5a0&amp;via=takadesigns&amp;text=Quick%20Guide%3A%20Creating%20a%20Plone%203%20theme%20product%20on%20the%20file%20system&amp;related=&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Fwww.takadesigns.com%2Fblog%2F2010%2F07%2F28%2Fcreating-a-plone-3-theme-product-on-the-file-system%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.takadesigns.com/blog/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div> 
<span class = "facebook-like" style = "height: 45px;  "><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.takadesigns.com/blog/2010/07/28/creating-a-plone-3-theme-product-on-the-file-system/&layout=button_count&send=false&show_faces=false&width=500&action=recommend&colorscheme=light&font=" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:500px; height:45px"></iframe></span><p><img style="border: none; float: right; margin: 0 0 15px 15px" src="http://www.takadesigns.com/blog/images/plone-logo.png" alt="Plone logo" /></p>
<p>Creating a <a href="http://www.plone.org">Plone</a> 3 theme product on the file system can be notoriously daunting for beginners. A lot of documentation exists, but it is somewhat fragmented and can be confusing. I&#8217;ve been <a href="http://www.takadesigns.com/plone">designing and skinning themes for Plone</a> for quite sometime now and thought it would be nice to have a quick guide on how to create Plone 3 theme products on the file system.</p>
<p><span id="more-1025"></span></p>
<p>There are essentially 3 things that you need to do which involve:</p>
<ol>
<li>Moving viewlets</li>
<li>Modifying viewlets</li>
<li>Adding theme files</li>
</ol>
<p>To start, you should first create your theme through the web in the ZMI and place all of the files in the <span class="source-code">/custom</span> folder.  Once your design is finalized, you can then move everything into your product on the file system. I like to use <a href="http://www.zope.org/Members/tseaver/FSDump">FSDump</a> to dump files from the ZMI into the file system.</p>
<h3>Through the web</h3>
<p><strong>1. Moving viewlets</strong></p>
<p>Plone’s default layout is composed of <a href="http://plone.org/documentation/manual/theme-reference/elements/viewlet">viewlets</a> such as the <span class="source-code">globalnav</span> (top navigation) that are controlled by viewlet managers. These viewlets can be re-arranged by re-ordering the viewlets through the web by appending <span class="source-code">@@manage-viewlets</span> to the end of your site URL: <span class="source-code">http://[your_plone_site]/@@manage-viewlets</span>.</p>
<p>For a quick reference on what each viewlet is, check out <a href="https://weblion.psu.edu/trac/weblion/wiki/PloneThreeWhereIsWhat">Where is What in Plone 3</a>.</p>
<p><strong>2. Modifying viewlets</strong></p>
<p>To modify the templates for each viewlet, you’ll need to go into the ZMI to <span class="source-code">/portal_view_customizations</span>.</p>
<p><strong>3. Adding theme files</strong></p>
<p>Files such as images and CSS should be placed in the <span class="source-code">/custom</span> folder within the ZMI</p>
<h3>The file system</h3>
<p>Once your design is finalized,  you need to transfer all of the files and layout changes from the web to the file system to create a Plone 3 theme product.</p>
<p>You should use Paster to generate the initial framework and files for your Plone 3 theme product on the file system. For more information on how to use Paster, check out <a href="http://plone.org/documentation/kb/how-to-create-a-plone-3-theme-product-on-the-filesystem">How to Create a Plone 3 Theme Product on the Filesystem</a>.</p>
<p><strong>1. Moving viewlets</strong></p>
<p>Re-ordering viewlets through the web is quite easy using the <span class="source-code">@@manage-viewlets</span> option. However, when creating a product on the file system, you’ll need to re-order these by calling specific rules within <span class="source-code">profiles/default/viewlets.xml</span>, which is created by Paster.</p>
<p>Let’s say you moved the <span class="source-code">personal_bar</span> to the top of the layout. You need to locate the viewlet manager that contains the viewlet using <span class="source-code">@@manage-viewlets</span>.</p>
<p><img src="http://www.takadesigns.com/blog/images/plone-viewlet-manager.jpg" alt="Screenshot of manage viewlet screen" /></p>
<p>By default, <span class="source-code">plone.personal_bar</span> is managed by the <span class="source-code">plone.portaltop</span> viewlet manager. A rule needs to be applied that re-orders the <span class="source-code">plone.personal_bar</span> viewlet within the <span class="source-code">plone.portaltop</span> viewlet manager.</p>
<p>Here is the rule within <span class="source-code">viewlets.xml</span>:</p>
<pre>...

 &lt;order manager="plone.portaltop" skinname="[YOUR_PLONE_THEME]"
     based-on="Plone Default"&gt;
     &lt;viewlet name="plone.personal_bar" insert-before="*"/&gt;
 &lt;/order&gt;

...
</pre>
<p>This rule says to place <span class="source-code">plone.personal_bar</span> before all other viewlets that are managed by the <span class="source-code">plone.portaltop</span> viewlet manager.</p>
<p>For more detailed information on moving viewlets, check out <a href="https://weblion.psu.edu/trac/weblion/wiki/MoveViewletsBetweenViewletManagers">Move Viewlets Between Viewlet Managers</a>.</p>
<p><strong>2. Modifying viewlets</strong></p>
<p>Any viewlets that you customized in <span class="source-code">/portal_view_customizations</span> through the ZMI goes into the <span class="source-code">browser/</span> folder of your theme that was created by Paster.</p>
<p>Let’s say you customized the <span class="source-code">footer</span> and <span class="source-code">global_sections</span>.  You’ll need to add the <span class="source-code">footer.pt</span> and <span class="source-code">sections.pt</span> templates in the <span class="source-code">browser/</span> folder and then reference them in <span class="source-code">browser/configure.zcml</span>:</p>
<pre>...

&lt;browser:viewlet
    name="plone.footer"
    for="*"
    manager="plone.app.layout.viewlets.interfaces.IPortalFooter"
    layer=".interfaces.IThemeSpecific"
    template="footer.pt"
    permission="zope.Public"
/&gt;

&lt;browser:viewlet
    name="plone.global_sections"
    for="*"
    manager="plone.app.layout.viewlets.interfaces.IPortalHeader"
    class=”plone.app.layout.viewlets.common.GlobalSectionsViewlet”
    layer=".interfaces.IThemeSpecific"
    template="sections.pt"
    permission="zope2.View"
/&gt;

...
</pre>
<p>One important thing to note is the <span class="source-code">class=&#8221;plone.app.layout.viewlets.common.GlobalSectionsViewlet&#8221;</span> attribute in <span class="source-code">global_sections</span>.</p>
<p><span class="source-code">global_sections</span> creates content dynamically and therefore references a special class. If you forget to include it, you’ll get an error. The footer on the other hand is only static text by default, so it doesn’t need the class attribute.</p>
<p>The <span class="source-code">manager=&#8221; &#8220;</span> attribute can also be found in <span class="source-code">@@manage-viewlets</span>.</p>
<p><img src="http://www.takadesigns.com/blog/images/plone-viewlet-manager-2.jpg" alt="Screenshot of manage viewlet screen" /></p>
<p><strong>3. Adding theme files</strong></p>
<p>You’ll need to place your theme files such as images and CSS in the <span class="source-code">skins/</span> folder, which is broken up into three sections:</p>
<p><span class="source-code">skins/plonetheme_[your_product_name]_custom_images</span><br />
<span class="source-code">skins/plonetheme_[your_product_name]_custom_templates</span><br />
<span class="source-code">skins/plonetheme_[your_product_name]_styles</span></p>
<p>Any custom CSS files also need to be be registered within <span class="source-code">portal_css</span>.  To do this, you’ll need to reference them in <span class="source-code">profiles/default/cssregistry.xml</span>.  Paster should have created them for you.</p>
<p>Note, you have two options for your image and CSS files. You can either place them in the <span class="source-code">skins/</span> folder or in the <span class="source-code">browser/</span> folder.  However, if you’ll be using any custom DTML calls in your CSS such as <span class="source-code">&amp;dtml-portal_url;</span> to generate your URL dynamically, you’ll need to keep them in the <span class="source-code">skins/</span> folder.  Only static CSS files can go into the <span class="source-code">browser/</span> folder.</p>
<p>As best practice, you should also create an <a href="https://weblion.psu.edu/trac/weblion/wiki/PloneThreeThemeUninstallProfile">uninstall profile</a>.  If you don’t, when your theme is uninstalled it may not reset your Plone site back to its default layout.</p>
<p>Now that you have your product, <a href="http://plone.org/documentation/kb/how-to-install-a-3-x-theme-using-buildout">install it</a>!</p>
<img src="http://feeds.feedburner.com/~r/takadesigns_plone/~4/NKDOixkkRwE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.takadesigns.com/blog/2010/07/28/creating-a-plone-3-theme-product-on-the-file-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.takadesigns.com/blog/2010/07/28/creating-a-plone-3-theme-product-on-the-file-system/</feedburner:origLink></item>
	</channel>
</rss>

