<?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>Kashit &#187; Themes</title>
	<atom:link href="http://www.kashit.org/words/themes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kashit.org</link>
	<description>home to Ehsan Quddusi</description>
	<lastBuildDate>Sun, 28 Feb 2010 18:43:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Drupal 5 theming basics</title>
		<link>http://www.kashit.org/code/drupal-5-theming-basics/</link>
		<comments>http://www.kashit.org/code/drupal-5-theming-basics/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 05:22:19 +0000</pubDate>
		<dc:creator>Ehsan Quddusi</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Drupal theme]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHPTemplate]]></category>
		<category><![CDATA[template files]]></category>
		<category><![CDATA[Themes]]></category>

		<guid isPermaLink="false">http://www.kashit.org/?p=184</guid>
		<description><![CDATA[<span class="dropcap">D</span>rupal is a content management framework written in PHP that can be used to organize &#038; display content, customize appearance and manage routine tasks on a website.

It is an open-source software distributed under the GPL ("GNU General Public License") and is maintained and developed by a community of thousands of users and developers.

Drupal was originally written by Dries Buytaert, who still heads the Drupal project. Buytaert transliterated the Dutch word 'druppel,' which means 'droplet' to create the name 'Drupal,' in order to make an indirect reference to the community aspects of the project through the Dutch word 'dorp,' meaning 'village.' He opened the source code for community work in 2001.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.drupal.org" target="_blank">Drupal</a> is a content management framework written in PHP that can be used to organize &amp; display content, customize appearance and manage routine tasks on a website.</p>
<p>It is an <a href="http://en.wikipedia.org/wiki/Open-source_software" target="_blank">open-source software</a> distributed under the <a href="http://www.gnu.org/copyleft/gpl.html" target="_blank">GPL</a> (&#8220;GNU General Public License&#8221;) and is maintained and developed by a community of thousands of users and developers.</p>
<p>Drupal was originally written by <a href="http://buytaert.net/" target="_blank">Dries Buytaert</a>, who still heads the Drupal project. Buytaert transliterated the Dutch word <em>&#8216;druppel&#8217;</em>, which means <em>&#8216;droplet</em>&#8216; to create the name &#8216;Drupal,&#8217; in order to make an indirect reference to the community aspects of the project through the Dutch word <em>&#8216;dorp&#8217;</em> , meaning <em>&#8216;village&#8217;</em>. He opened the source code for community work in 2001.</p>
<p>Tens of thousands of people and organizations are using <a href="http://drupal.org/cases" target="_blank">Drupal</a> to power scores of different web sites, including</p>
<ul>
<li>Community web portals</li>
<li> Discussion sites</li>
<li> Corporate web sites</li>
<li> Intranet applications</li>
<li> Personal web sites or blogs</li>
<li> Aficionado sites</li>
<li> E-commerce applications</li>
<li> Resource directories</li>
<li> Social Networking sites</li>
</ul>
<p>While some web designers have criticized Drupal as difficult to learn, the system has received extensive accolades for its usefulness and relatively rapid build time. The modular approach of Drupal and its ability to enhance the core functionality by use of hooks is a marvel of software engineering.</p>
<p>Drupal provides a flexible way to create custom look and feel of website by use of themes. Drupal theme essentially consists of atleast one template file, a style file for custom appearance &amp; a theme file for overriding <a href="http://api.drupal.org/api/group/themeable/5" target="_blank">Drupal themeable functions</a>. Drupal 5 comes with 4 default themes.</p>
<h4>Where are Drupal themes located</h4>
<p><img class="alignnone size-full wp-image-185" title="Directory structure &amp; placement for Drupal 5 themes" src="http://media.kashit.org/2008/12/directory-structure.jpg" alt="" width="460" height="356" /></p>
<p>Drupal default themes are contained in <em>themes</em> folder in the root installation of Drupal. Apart from themes, the folder contains <em>theme engines</em> available to the installation.</p>
<p>Another location for the themes is inside sites folder. Due to Drupal&#8217;s multi-site support, we have have individual themes available for the sites installed in the installation. Those themes need to be put under their respective sites to make them available. Sounds too boring! Let me come to point.</p>
<p>The recommended custom theme location in Drupal is under <em>sites/all/themes/</em> folder.</p>
<h4>Drupal Theme Administration</h4>
<p>You need to have proper permissions to change the theme of your Drupal site. To change the default drupal theme, login to the site and then go to Theme Administration found under Site Building &#8211; Themes. The default url for the theme administration is <em>/admin/build/themes</em>.</p>
<p><img class="alignnone size-full wp-image-192" title="Drupal 5 theme administration" src="http://media.kashit.org/2008/12/theme-administration.jpg" alt="" width="460" height="288" /></p>
<p>By default, the garland theme is selected. The folder name of each theme represents its name on the administration page (Configurable name and description available in Drupal 6). You can change the theme by simply clicking the radio box of that theme found under default column. Saving the changes will result in applying of new theme to the site.</p>
<p><img class="alignnone size-full wp-image-193" title="Drupal 5 theme configuration" src="http://media.kashit.org/2008/12/theme-configuration.jpg" alt="" width="460" height="288" /></p>
<p>You can make configuration changes to the theme by clicking on the configure button found on that row. A list of default configuration options will be displayed where we can do the necessary. You can toggle the display of various page elements like search box, site name, logo, site slogan, shortcut icon, user pictures etc from this page. You can add your custom options also for the theme like in case of color picker for default garland theme.</p>
<h4>How theme works</h4>
<p><img class="alignnone size-full wp-image-194" title="How Drupal 5 theme works" src="http://media.kashit.org/2008/12/theme-ingredients.jpg" alt="" width="460" height="109" /></p>
<p>Drupal theme essentially consists of two files; a template file (<em>page.tpl.php</em> in case of phpTemplate) and a <em>CSS</em> file for presentation. A template file is a mix of HTML or XHTML markup alongwith the templating language specific code. Drupal by default supports <em>PHPTemplate</em> as the templating language through use of PHPTemplate theme engine. Theme engines control how certain themes interact with Drupal. In addition to PHPTemplate, Drupal has support for many other popular templating engines through installation of their <a href="http://drupal.org/project/Theme+engines" target="_blank">theme engines</a>. A theme engine makes many variables avaialable to template files and processes these template pages to render output.</p>
<p>In the next post of this series, I will be writing about <em>&#8216;How to develop Drupal 5 theme&#8217;</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kashit.org/code/drupal-5-theming-basics/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to develop Wordpress Themes (Basic)</title>
		<link>http://www.kashit.org/design/how-to-develop-wordpress-themes-basic/</link>
		<comments>http://www.kashit.org/design/how-to-develop-wordpress-themes-basic/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 08:47:30 +0000</pubDate>
		<dc:creator>Ehsan Quddusi</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[HTML + XHTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://new.kashit.org/?p=25</guid>
		<description><![CDATA[<span class="dropcap">W</span>ordpress, one of the most popular blogging platforms of the world, has a large user base throughout the world. One of the main attractions for its users is the great themes contributed by the thousands of users around the world. Though in general, bloggers use the themes already available and contributed by other users, but sometimes there is a need to customize the theme or create a new theme from the scratch. Without getting to much in the history, let me show you how to create a Wordpress theme with as little expertise as possible. Keep in mind that developing a Wordpress theme doesnot require <strong>PHP</strong> expertise from your side. Just a little of <strong>CSS</strong> and working knowledge of <strong>XHTML / PHP</strong> will work.]]></description>
			<content:encoded><![CDATA[<p><span class="dropcap">W</span>ordpress, one of the most popular blogging platforms of the world, has a large user base throughout the world. One of the main attractions for its users is the great themes contributed by the thousands of users around the world. Though in general, bloggers use the themes already available and contributed by other users, but sometimes there is a need to customize the theme or create a new theme from the scratch. Without getting to much in the history, let me show you how to create a Wordpress theme with as little expertise as possible. Keep in mind that developing a Wordpress theme doesnot require <strong>PHP</strong> expertise from your side. Just a little of <strong>CSS</strong> and working knowledge of <strong>XHTML / PHP</strong> will work.</p>
<h4>Getting into Wordpress Theme</h4>
<p>Before starting the actual development of the theme, we need to understand how Wordpress actually works and how the content is presented to the users. Well, the short answer is that the content in Wordpress is served by themes to the users. Themes in Wordpress is a combination of CSS and PHP files that reside inside a particular directory at a particular place. The ‘particular directory’ meant for storing of theme related stuff is named with the name of theme and this will be the public identity of your theme. The theme directory resides in <strong>wp-content/themes/</strong> directory. Actually, all the Wordpress themes reside under the same directory.</p>
<h4>Structure of Wordpress Theme</h4>
<p>The Wordpress theme mainly consists of four regions viz, header, footer, content &amp; sidebar. You can theme every region with an independent theme file. Wordpress theme essentially consists of two files, one for CSS named <strong>style.css</strong> and another for content named <strong>index.php</strong>. We can run our theme with these two files only and later on add more files to fine tune the theme.</p>
<h4>Get Started</h4>
<p>Let’s start actual theme development. With your favourite text editor or PHP editor, create a blank CSS file inside your theme folder, let’s say <strong>cool-theme</strong>, and name it as <strong>style.css</strong>. Put a few lines of comments at the top like this.<br />
<code><br />
/*Theme Name: cool-theme<br />
Theme URI: http://www.yoursitename.com<br />
Description: My theme is a cool and beautiful theme<br />
Version: 1.0.0<br />
Author: Ehsan Quddusi<br />
Author URI: http://www.authorsitename.com<br />
*/<br />
</code></p>
<p><img class="alignnone size-full wp-image-28" title="wordpress-snapshot" src="http://media.kashit.org/2008/11/wordpress-snapshot.gif" alt="" width="460" height="240" /></p>
<p>Well this is the standard comment style for Wordpress CSS file. Actually this information is read by Wordpress to display it in the theme list alongwith the provided thumbnail. You can see the theme list in admin menu of Wordpress under Presentation heading. All the lines in the above comment are self explanatory and you can well understand what they mean. Now that our CSS file is created with the initial theme information in the form of comment, it is time to create the PHP file to display content on the page. Again using any text editor, let’s create a PHP file named <strong>index.php</strong><br />
Now let’s put some code into it, to display all the posts available there.<br />
<code><br />
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;<br />
&lt;head&gt;<br />
&lt;title&gt; My Wordpress Theme&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;?php if (have_posts()) {<br />
while (have_posts()) {<br />
the_post();<br />
the_title();<br />
echo '&lt;br/&gt;';<br />
}<br />
}?&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
</code></p>
<p><img class="alignnone size-full wp-image-29" title="wordpress-snapshot-2" src="http://media.kashit.org/2008/11/wordpress-snapshot-2.gif" alt="" width="460" height="240" /><br />
Wow! you are done. With just a few lines of code, you are able to fetch all the Wordpress Post titles from the database. Let&#8217;s have a look on the above code. HTML code is same as you will be using for normal web development. Now let&#8217;s have a look on PHP code wrapped inside <strong>&lt;?php and ?&gt;</strong>. Here we are using a condition to verify the output and if available loop through it and display contents. Oh! I know you will be feeling boring. Ok let&#8217;s quickly move next. Actually here we are using an in-built function of Wordpress, <strong>have_posts()</strong>, to fetch the contents of the post. The above function first checks for the posts and if available loops through them to fetch content the content of each of them and display their title using <strong>the_title()</strong>.</p>
<p>It is interesting to note that we displayed titles of all the posts with just few lines of code. Let&#8217;s have some fun now. Every post in Wordpress has an <strong>ID</strong> associated with it and we will provide a link to each title to display its content. Let&#8217;s modify the above written PHP code like this.<br />
<code><br />
&lt;?php<br />
if (have_posts()){<br />
while (have_posts()) {<br />
the_post(); ?&gt;<br />
&lt;a href="&lt;?php the_permalink();?&gt;"&gt;&lt;?php the_title();?&gt;&lt;/a&gt;&lt;br/&gt;<br />
&lt;?php if(!is_home()) {<br />
print '&lt;p&gt;';<br />
the_content();<br />
print '&lt;/p&gt;';<br />
}<br />
}<br />
}<br />
?&gt;<br />
</code></p>
<p><img class="alignnone size-full wp-image-30" title="wordpress-snapshot-3" src="http://media.kashit.org/2008/11/wordpress-snapshot-3.gif" alt="" width="460" height="203" /></p>
<p>And here it is. Magic! as you can see. Again by adding 4 lines of code, we are able to provide a link to each post title to show its contents on an independent page. This is the beauty of Wordpress. Minimising as much code as possible and maximising productivity.</p>
<p>We will now update our code again to display category with each post as well as date of posting and author.<br />
<code><br />
&lt;?php<br />
if (have_posts()){<br />
while (have_posts()) {<br />
the_post(); ?&gt;<br />
&lt;a href="&lt;?php the_permalink();?&gt;"&gt;&lt;?php the_title();?&gt;&lt;/a&gt;&lt;br/&gt;<br />
Posted under &lt;strong&gt;&lt;?php the_category(',');?&gt;&lt;/strong&gt; at &lt;strong&gt;&lt;?php the_time('F jS, Y');?&gt;&lt;/strong&gt; by &lt;strong&gt;&lt;?php the_author();?&gt;&lt;/strong&gt;&lt;hr/&gt;<br />
&lt;?php if(!is_home()) {<br />
print '&lt;p&gt;';<br />
the_content();<br />
print '&lt;/p&gt;';<br />
}<br />
}<br />
}<br />
?&gt;<br />
</code></p>
<p><img class="alignnone size-full wp-image-31" title="wordpress-snapshot-4" src="http://media.kashit.org/2008/11/wordpress-snapshot-4.gif" alt="" width="460" height="203" /></p>
<p>And we are done. By putting a single line of code, we have been able to derieve post category, post date &amp; post title for each post. Wordpress API provides all the theme related functions to minimize custom coding. As you can see we used three function in the above written one line. <strong>the_category()</strong> function is responsible for deriving categories of each post separated by supplied argument <strong>&#8216;,&#8217;</strong>. We can pass many optional arguments to the <strong>the_catgory()</strong> function to exclude some categories or provide post counts etc. Another function used is <strong>the_time(&#8216;F jS, Y&#8217;)</strong>, meant for displaying date of the post while as <strong>the_author</strong> displays the link for the author alongwith his/her name. This ends the basic tutorial on Wordpress theming.</p>
<p>One thing to note is that Wordpress allows splitting of code into multiple files for the sake of manageability and granular control over design. Till now we have used only one file in our theme. In the next tutorial we will be using multiple files for theming to achieve granular control along with doing some designing using CSS.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kashit.org/design/how-to-develop-wordpress-themes-basic/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
