<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Marcus Povey &#187; themes</title>
	<atom:link href="http://www.marcus-povey.co.uk/tag/themes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marcus-povey.co.uk</link>
	<description>Making the world a better place, one byte at a time...</description>
	<lastBuildDate>Mon, 06 Feb 2012 19:13:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
	<atom:link rel='hub' href='http://www.marcus-povey.co.uk/?pushpress=hub'/>
		<item>
		<title>All about themes</title>
		<link>http://www.marcus-povey.co.uk/2008/09/15/all-about-themes/</link>
		<comments>http://www.marcus-povey.co.uk/2008/09/15/all-about-themes/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 18:54:57 +0000</pubDate>
		<dc:creator>Marcus Povey</dc:creator>
				<category><![CDATA[elgg]]></category>
		<category><![CDATA[#ue]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[themes]]></category>

		<guid isPermaLink="false">http://www.marcus-povey.co.uk/?p=87</guid>
		<description><![CDATA[Themes for Elgg are both extremely easy to develop and incredibly powerful. Using themes you can completely change how an Elgg install looks and feels (and even behaves). Since there has been a fair amount of discussion of themes on the groups, I thought it would be a good idea to write a brief post [...]]]></description>
			<content:encoded><![CDATA[<p>Themes for Elgg are both extremely easy to develop and incredibly powerful. Using themes you can completely change how an Elgg install looks and feels (and even behaves).</p>
<p>Since there has been a fair amount of discussion of themes on the groups, I thought it would be a good idea to write a brief post about it.</p>
<p>Themes use two key Elgg concepts &#8211; namely, the <a href="http://docs.elgg.org/wiki/Plugin_development">plugin architecture</a> and the <a href="http://docs.elgg.org/wiki/Views">views system</a>.</p>
<p>By far the easiest and flexible way to make a theme for Elgg is to build it as a plugin. This makes it easy to distribute (since they are self contained) and lets you turn the theme on and off from the admin panel (making the theming process far less invasive!)</p>
<p>What you must first do is create a new plugin directory under /mod (<a href="http://docs.elgg.org/wiki/Plugin_development#Core_requirements">documented here</a>). In a nutshell; create a directory in the name of your theme, a new start.php and a new <a href="http://docs.elgg.org/wiki/Manifests">manifest.xml</a>.</p>
<p>Once you&#8217;ve done this you then can start modifying views. This can be done either by extension or by view overriding.</p>
<p><strong>View extension</strong><br />
The first way is to add extra stuff to an existing view via the extend view function from within your start.php&#8217;s initialisation function.</p>
<p>For example, the following start.php will add <code>mytheme/spotlight</code> to the already existing site spotlight:</p>
<blockquote><p><code>&lt;?php</code></p>
<p><code>function mytheme_init()<br />
{<br />
extend_view('page_elements/spotlight','mytheme/spotlight');<br />
}</code></p>
<p><code>register_elgg_event_handler('init','system','mytheme_init');</code></p>
<p><code>?&gt;</code></p></blockquote>
<p><strong>View overriding</strong><br />
The next method is to override an existing theme, completely replacing it with the one provided by your plugin.</p>
<p>View files provided by plugins automatically take precedence over views from the core. So all we have to do to entirely replace the existing spotlight is to create a new spotlight.php in the appropriate hierarchy.</p>
<p>So, if the original view is stored in:</p>
<p><code>/elgg/views/default/page_elements/spotlight.php</code></p>
<p>We need to create the file:</p>
<p><code>/elgg/mod/mytheme/views/default/page_elements/spotlight.php</code></p>
<p>Now, when we go to the admin panel and activate our theme the spotlight will be replaced by whatever you put in that file. Simple eh?</p>
<p>You can of course do this with any view.</p>
<p>Using a combination of these methods means you can replace the entire look and feel of a site very quickly indeed, although I would suggest that you start slowly since many views do some quite complicated things.</p>
<div class="wsbuttons">
	<div class="shareblob facebook">
		<div class="fb-like" data-href="http://www.marcus-povey.co.uk/2008/09/15/all-about-themes/" data-send="false" data-layout="box_count" data-width="60" data-show-faces="false" data-colorscheme="light"></div>
	</div>

	<div class="shareblob google">
		<div class="g-plusone" data-size="tall" data-href="http://www.marcus-povey.co.uk/2008/09/15/all-about-themes/"></div>
	</div>

	<div class="shareblob twitter">
		<div class="twitter">
			<a href="https://twitter.com/share?url=http%3A%2F%2Fwww.marcus-povey.co.uk%2F2008%2F09%2F15%2Fall-about-themes%2F&count=vertical" class="twitter-share-button" data-lang="en">Tweet</a>
			<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
		</div>
	</div>

</div>
	]]></content:encoded>
			<wfw:commentRss>http://www.marcus-povey.co.uk/2008/09/15/all-about-themes/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

