Child themes

63 views
Skip to first unread message

Guido Erlinger

unread,
Aug 20, 2012, 5:53:34 PM8/20/12
to habari...@googlegroups.com
Hello,

I tried to start working with child themes in the development version of habari.

According to the wiki one theme.xml
should be enough to start a child theme.
But all the formatting is gone (wrong path to styles.css) and some notes (undefined variables, invalid argument) are output.

Is the Charcoal theme ready for child themes?

Here my theme.xml:

<?xml version="1.0" encoding="utf-8" ?>
<pluggable type="theme" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schemas.habariproject.org/pluggable/0.8">
    <name>CharcoalChild</name>
    <parent>Charcoal</parent>
    <license url="http://www.apache.org/licenses/LICENSE-2.0.html">Apache Software License 2.0</license>
   
    <author url="http://habariproject.org/">Habari Community</author>
   
    <version>0.0</version>
    <url>http://habariproject.org/</url>
    <description><![CDATA[Child theme for Charcoal]]></description>

    <copyright>2012</copyright>
   
    <template_engine>rawphpengine</template_engine>
   
    <areas>
        <area name="sidebar">
            <description><![CDATA[The sidebar area]]></description>
        </area>
        <area name="nav">
            <description><![CDATA[The sidebar area]]></description>
        </area>
    </areas>
   
</pluggable>


Thank you for your help,
guido

Konzertheld

unread,
Apr 6, 2013, 7:21:47 PM4/6/13
to habari...@googlegroups.com
I'd like to bump this as I am experiencing the same while trying to make a child theme of Wazi in Habari 0.9.

Owen Winkler

unread,
Apr 6, 2013, 7:56:43 PM4/6/13
to habari...@googlegroups.com
On 8/20/2012 5:53 PM, Guido Erlinger wrote:
>
> According to the wiki one theme.xml should be enough to start a child theme.
> But all the formatting is gone (wrong path to styles.css) and some notes
> (undefined variables, invalid argument) are output.
>
> Is the Charcoal theme ready for child themes?

Charcoal, I suspect, is not ready and will likely never be ready to be
made into a parent theme -- It's a long-standing theme from early in
Habari, and it just hasn't been retrofitted with the things that make
parent/child themes easy.

Wazi, on the other hand, is good to use as a parent theme, and I am
doing so on my own site.

The key thing is that Wazi's CSS files are added via its theme class.
If you provide no theme class in your child theme, then the default
Theme class is used, and no styles are added. If you want Wazi to add
its CSS to the output stack, you must also include (in addition to the
theme.xml) a barebones class file, which extends Wazi's class:

class MyChildTheme extends WaziTheme {}

Then you can add css and javascript files to your child theme's assets
directory, and Habari will automatically add them to the appropriate
stacks for output, in addition to the ones from Wazi.

If you want your child class to have methods (to change post formatting
or add other features), then you will need to extend WaziTheme and call
any parent methods or the methods that Wazi provides that are useful for
output (action_template_header) will not be called. On the other hand,
if you want to override what Wazi does in action_template_header
entirely, you should implement that method and not call
parent::action_template_header(). These are basic OOP principles that
folks will recognize.

Finally, I just pushed a change to 0.10 that eliminates the need to
include this vestigial theme file and class at all, allowing you to
specify only the xml and an asset directory.

Owen


Konzertheld

unread,
Apr 6, 2013, 9:43:50 PM4/6/13
to habari...@googlegroups.com
Thanks Owen, that helped. I expected the assets folder to work without the theme.php (as it does now with the change). The rest was clear, I just wanted to change some of the css. :)
Reply all
Reply to author
Forward
0 new messages