<?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>Tech4Him - Technology with Integrity &#187; templates</title>
	<atom:link href="http://blog.tech4him.com/tags/templates/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tech4him.com</link>
	<description>A Christian technology chaos wrangler and his thoughts</description>
	<lastBuildDate>Wed, 24 Mar 2010 23:15:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Parent Feed Title in FeedAPI Item Node</title>
		<link>http://blog.tech4him.com/2009/10/parent-feed-title-in-feedapi-item-node/</link>
		<comments>http://blog.tech4him.com/2009/10/parent-feed-title-in-feedapi-item-node/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 22:35:58 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[feedapi]]></category>
		<category><![CDATA[openpublish]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://blog.tech4him.com/?p=853</guid>
		<description><![CDATA[We recently began testing the installation profile for Drupal called OpenPublish. The good folks at Phase 2 Technology have opened this installation profile (distribution) up for all to use with some key features for the semantic web. This post is not to go over or compares features with other similar distributions. Instead this is more [...]]]></description>
			<content:encoded><![CDATA[<p>We recently began testing the installation profile for <a href="http://drupal.org" target="_blank">Drupal</a> called <a href="http://www.opensourceopenminds.com/openpublish" target="_blank">OpenPublish</a>. The good folks at <a href="http://www.phase2technology.com/" target="_blank">Phase 2 Technology</a> have opened this installation profile (distribution) up for all to use with some key features for the semantic web. This post is not to go over or compares features with other similar distributions. Instead this is more about how to get the parent feed title into the template for a node created from a feed-item with the <a href="http://drupal.org/project/feedapi" target="_blank">feedapi module</a>.</p>
<p><span id="more-853"></span></p>
<p><a href="http://blog.tech4him.com/wp-content/uploads/drupal_by_line_parent_feed.png"><img class="alignright size-medium wp-image-854" title="drupal_by_line_parent_feed" src="http://blog.tech4him.com/wp-content/uploads/drupal_by_line_parent_feed-300x101.png" alt="drupal_by_line_parent_feed" width="300" height="101" /></a>Let&#8217;s jump right in. The scenario is that we have a content type of article. The node-article.tpl.php displays the Drupal node author as part of the by line of the article. In our case, we wanted to change this.</p>
<p>Instead, we will have articles created by staff, as well as articles automatically generated from RSS feeds. It is important for us to honor our partners by not showing the article as being authored by us, but instead to change the authored by line to give credit to the originating feed source where appropriate.</p>

<p>Enough talk, let&#8217;s see details.</p>
<p>First, we need to make the parent feed&#8217;s title and link available as a variable for the templates. We did this in Drupal 6 by adding to the existing template.php file. Using the <a href="http://drupal.org/node/223430" target="_blank"><em>phptemplate_preprocess_node</em></a> hook, we can add variables that can be accessed in node templates. (Note: If you are following along in an OpenPublish distribution, this function does not exist in the standard template.php file. You will need to add it.)</p>
<p>Keep in mind that when you use feedapi/feedapi node module to turn a feed item into a node, the <em>$node</em> object does not have all the details about the parent feed that generated the feed-item. It does however contain the <em>nid</em> (node id) of the feed that generated it. Soooo&#8230; in our custom code, we need to get this parent feed nid, load the feed title and url and then stuff the link into a variable to use in our node template.</p>
<p>Here is the function as added to the template.php:</p>
<pre>/**
* Override or insert PHPTemplate variables into the node templates.
*/
function phptemplate_preprocess_node(&amp;$vars) {</pre>
<pre>  // 20091029 Added for Parent Feed Title Link
 if ($vars['node']-&gt;feedapi_node-&gt;feed_nids) {
    $parent_feed_node_id = array_values($vars['node']-&gt;feedapi_node-&gt;feed_nids);
    $parent_feed_node = node_load($parent_feed_node_id[0]);
    $vars['parent_feed_link'] = l($parent_feed_node-&gt;title, $parent_feed_node-&gt;feed-&gt;url);
  }</pre>
<pre>}</pre>
<p>Just a note that the array index of <em>feed_nids</em> is not zero based but instead, the array index is the same number as the <em>nid</em>. That makes doing the typical <em>$vars['node']-&gt;feedapi_node-&gt;feed_nids[0]</em> impossible. That is where the php <em>array_values()</em> function comes to the rescue. It takes all the array values from <em>feed_nids</em> and created a zero base indexed array.</p>
<p>Now, we have a variable called <em>$parent_feed_link</em> that is available in our template files. So, our next step is to use it. Since the content type we want to impact is the article type, we are going to modify our node-article.tpl.php. Below is the portion of the file that outputs the article by line:</p>
<pre>&lt;div&gt;Article |
&lt;?php print date('m.d.y', $node-&gt;created); ?&gt;
 | By  
&lt;?php  
 $author = user_load(array('uid' =&gt; $node-&gt;uid));
 if ($parent_feed_link) {
   print $parent_feed_link;
 }
 else {
   print l($author-&gt;profile_full_name, 'user/'.$node-&gt;uid);  
 }
?&gt;    
&lt;/div&gt;</pre>
<p>As you can see above, we now test to see if the <em>$parent_feed_link</em> actually has a value. If so, we want to output that link. Otherwise, the article was not created from a feed-item and we want to show the actual author of the node.</p>
<p>I know this is simple for many of you, however it took me a little while to figure out where in Drupal 6 to generate these custom variables. In Drupal 5, you may have typically done this in the <em>_phptemplate_variables</em> hook in your template.php.</p>
<h4>Well, did we do it wrong? Do you know a better way? Let us know with a comment below.</h4>
<p>Blessings.</p>
<img src="http://blog.tech4him.com/?ak_action=api_record_view&id=853&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.tech4him.com/2009/10/parent-feed-title-in-feedapi-item-node/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Drupal 6 Custom Maintenance Pages</title>
		<link>http://blog.tech4him.com/2009/02/drupal-6-custom-maintenance-pages/</link>
		<comments>http://blog.tech4him.com/2009/02/drupal-6-custom-maintenance-pages/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 08:25:26 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[themes]]></category>

		<guid isPermaLink="false">http://blog.tech4him.com/?p=211</guid>
		<description><![CDATA[Do you follow the instructions for upgrading Drupal? If you do, you put your site into maintenance mode as part of the process. (I smile writing this because I haven&#8217;t always followed those instructions and I&#8217;m betting you haven&#8217;t always either.) It is the right thing to do though.
But that is only one reason your [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="external nofollow" href="http://www.flickr.com/photos/91218927@N00/2484571663"><img src="http://farm4.static.flickr.com/3112/2484571663_71d929ec67_m.jpg" border="0" alt="workin" hspace="8" align="left" /></a>Do you follow the instructions for upgrading Drupal? If you do, you put your site into maintenance mode as part of the process. (I smile writing this because I haven&#8217;t always followed those instructions and I&#8217;m betting you haven&#8217;t always either.) It is the right thing to do though.</p>
<p>But that is only one reason your users might see the maintenance page. If your host has database problems, you could be showing your customers the default Drupal maintenance or offline page. Probably not the image you were looking for. This article will walk you through the process of creating custom maintenance/offline pages for your Drupal sites that will keep a profession look and feel, respecting your site design and style.</p>
<p><span id="more-211"></span></p>
<h2>Maintenance vs. Offline</h2>
<p><a href="http://blog.tech4him.com/wp-content/uploads/site_maint_settings.png"><img class="alignleft size-medium wp-image-218" style="margin: 5px 10px;" title="site_maint_settings" src="http://blog.tech4him.com/wp-content/uploads/site_maint_settings-300x168.png" alt="site_maint_settings" width="300" height="168" /></a>After reviewing a number of references on Drupal.org and finally landing on these instructions, I have concluded to following definitions.</p>
<blockquote><p><strong>Maintenance Mode</strong> &#8211; This mode is put in place by the site administrator via the <em class="tips">Administer &gt; Site configuration &gt; Site maintenance</em> settings on a Drupal site. Administrators can still access the site.</p>
<p><strong>Offline Mode</strong> &#8211; This mode is enabled when the Drupal site is unable to connect to its database. (Think Maintenance mode without DB access) This typically indicates a significant failure of the database services.</p></blockquote>
<p>So, maintenance mode is typically done on purpose by an administrator while an offline occurrence typically would be accidental or part of schedule maintenance. This distinction is important because in offline mode, your template needs to be able to function on its own without calling the database in order to function.</p>
<h2>Custom Maintenance Mode Page</h2>
<p><a href="http://blog.tech4him.com/wp-content/uploads/std_site_maint_view_minelli.png"><img class="alignright size-medium wp-image-219" title="std_site_maint_view_minelli" src="http://blog.tech4him.com/wp-content/uploads/std_site_maint_view_minelli-300x155.png" alt="std_site_maint_view_minelli" width="300" height="155" /></a>Let&#8217;s tackle the maintenance mode page first. The idea here is that when the administrator places the Drupal website into maintenance mode that a friendly page is served to your customers. We want our maintenance page to have a consistent look and feel with the rest of our site.</p>
<p><a href="http://blog.tech4him.com/wp-content/uploads/add_maint_theme_key.png"><img class="size-medium wp-image-215 alignright" title="add_maint_theme_key" src="http://blog.tech4him.com/wp-content/uploads/add_maint_theme_key-300x173.png" alt="add_maint_theme_key" width="300" height="173" /></a>By default, when you set your site offline in maintenance mode, your customers see the maintenance page from the Minelli default core theme. <strong><em>This is regardless of the default theme chosen for your site.</em></strong> This is one of the biggest sources of confusion. Drupal has this configured by default in your <em>settings.php</em> file.</p>
<p>In our case, let&#8217;s say we are using the wonderful <a href="http://drupal.org/project/acquia_marina">Acquia Marina theme</a> as the default for our site. With this in mind, we need to modify one file on our Drupal site. Navigate to your Drupal site root directory and then to the <em>/sites/default/settings.php</em> file and open it up.Â  Using your favorite editor, add the following line to the end of the <em>settings.php</em> file.</p>
<blockquote>
<pre>$conf['maintenance_theme'] = 'acquia_marina';</pre>
</blockquote>
<p>So, we added the configuration key &#8216;maintenance_theme key to our <em>settings.php</em> file and changed the theme value to &#8216;acquia_marina&#8217;.</p>
<p><a href="http://blog.tech4him.com/wp-content/uploads/new_maint_page.png"><img class="alignright size-medium wp-image-216" title="new_maint_page" src="http://blog.tech4him.com/wp-content/uploads/new_maint_page-300x62.png" alt="new_maint_page" width="300" height="62" /></a>This setting change has now told Drupal to use the acquia_marina theme for the maintenance page. So, reload your browser and refresh your site. Lucky for us, the Acquia Marina theme comes with a custom maintenance page, but if your theme doesn&#8217;t, read on.</p>
<h3>No maintenance-page.tpl.php In Your Theme?</h3>
<p>So, if you refresh and things look odd, Hmmm&#8230;.so why does the page look like an unstyled page, not like your theme? Well, now we are on step 2. Drupal has looked at our theme for a maintenance-page.tpl.php page, however we don&#8217;t have one yet in our theme. So it&#8217;s time to created one.</p>
<p>There are two thoughts on how to do this. First, some folks prefer to start with the generic temple found in <em>modules/system/maintenance-page.tpl.php</em> while others prefer to start with their theme page.tpl.php and modifying it. Either way, you need to get a <em>maintenance-page.tpl.php</em> in your theme directory.</p>
<p>Now, theming the page itself is beyond the scope of this article but the same <a href="http://drupal.org/theme-guide/6">Drupal 6 theme concepts</a> apply.</p>
<h2>Maintenance Offline Mode</h2>
<p>As we described earlier, there is not only the maintenance mode that the administrator can set, there is also an offline mode that is engaged by an inability of Drupal to connect to the database. Again, there are two ways you can address this in Drupal 6. One is in the <em>maintenance-page.tpl.php</em> and the other is the creation of a separate <em>maintenance-page-offline.tpl.php</em>.</p>
<h3>Offline In Maintenance-page.tpl.php</h3>
<p>If you want the same maintenance.tpl.php to serve both maintenance mode and offline mode you need to keep one thing in mind. In offline mode, Drupal does not have access to the database. Therefore, any theme template calls for data from the Drupal DB will fail.</p>
<blockquote><p><em>As of the writing of this article, the Acquia Marina theme does not gracefully handle the db offline scenario in the template.php</em></p></blockquote>
<p>According to the Drupal documentation:</p>
<blockquote><p><em>&#8220;Any function call that depends on the database should be checked first with <a rel="nofollow" href="http://api.drupal.org/api/function/db_is_active/6">db_is_active</a>. The variable $db_is_active can also be used from the template.&#8221;</em></p></blockquote>
<p>Here is a <a href="/wp-content/uploads/templatephp.txt">slightly modified version</a>, available for download, of the Acquia Marina template.php that takes care of the DB errors by checking for $db_is_active where necessary.<em><br />
</em></p>
<h3>Custom Maintenance-page-offline.tpl.php</h3>
<p>Another way to handle the offline mode specifically is to create a separate maintenance-page-offline.tpl.php file. The contents of this file will be used to render the custom offline mode page to the user. The benefit here is that your messaging can be different for an offline versus maintenance mode condition.</p>
<p>Personally I prefer this since access to the DB has been lost, theme settings are not available. Thus, you can hard-code, logos or such as needed in this separate file.</p>
<h2>Conclusion</h2>
<p>Again, Drupal gives you many options to customize your site. It just takes learning the possibilities and intricacies of the platform. We hope this article helps you better theme your maintenance and maintenance offline pages.</p>
<p>Blessings.</p>
<img src="http://blog.tech4him.com/?ak_action=api_record_view&id=211&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.tech4him.com/2009/02/drupal-6-custom-maintenance-pages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t Dump Drupal &#8211; It is Powerful</title>
		<link>http://blog.tech4him.com/2009/01/dont-dump-drupal-it-is-powerful/</link>
		<comments>http://blog.tech4him.com/2009/01/dont-dump-drupal-it-is-powerful/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 22:58:28 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[cck]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://blog.tech4him.com/?p=178</guid>
		<description><![CDATA[
I recently came across this blog post talking about someone&#8217;s decision to &#8220;dump&#8221; Drupal as a platform for a site idea they had. As I read the short post, I quickly found that I was shouting &#8220;don&#8217;t dump Drupal&#8221; in the back of my mind.
The author describes three reasons why Drupal didn&#8217;t work out for [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="border: 0pt none; margin-left: 8px; margin-right: 8px;" src="http://farm3.static.flickr.com/2077/2255781557_d7148597a7_m.jpg" border="0" alt="Fear of the Dark" hspace="8" width="240" height="180" align="left" /></p>
<p>I recently came across <a href="http://dirtmind.wordpress.com/2009/01/27/looking-at-drupal/">this blog post</a> talking about someone&#8217;s decision to &#8220;dump&#8221; <a href="http://drupal.org">Drupal</a> as a platform for a site idea they had. As I read the short post, I quickly found that I was shouting &#8220;don&#8217;t dump Drupal&#8221; in the back of my mind.</p>
<p>The author describes three reasons why Drupal didn&#8217;t work out for their use.</p>
<p><span id="more-178"></span></p>
<blockquote>
<ol>
<li> The look and feel of the site was inconsistent between the homepage and forum which made it feel like two separate sites.</li>
<li>The homepage, using drupal (sic) plugins for columns was a nightmare to configure &#8211; massively overcomplicated! Drupal is simple, but these plugins arenâ€™t!</li>
<li>Drupal is too restrictive on styling and based on the complexity of the multi column plugins the idea of customising (sic) it filled be with a horror akin to being told I would have to listen to a Steps album!</li>
</ol>
</blockquote>
<p>Hmmmm&#8230;.this got me thinking. Drupal can be easily setup and used &#8220;out of the box&#8221;. Having said that, I still find the available, User centric manuals, tutorials severely lacking for the complete newbie user/contributor (not administrator).</p>
<p>Now, if you really want to use the super powerful platform features of Drupal to provide a more complex solution, as it appears this person want to scratch the surface of, there is a fairly steep learning curve. But, the key is that the framework is VERY powerful and flexible. Unfortunately it sounds like the post author was unable or unwilling to find the time and materials to learn more about the platform.</p>
<p>All three of the reasons given by the author seem to be about look, feel and styling (mostly). Oh my. This is where Drupal theming absolutely shines. With the knowledge of Drupal theming combined with the necessary design skills a Drupal site can be made to look virtually any way you want.</p>
<blockquote><p><em>On the surface it sounds like the author could have gotten what he wanted with a <a href="http://drupal.org/theme-guide">custom theme</a>, page-front.php, <a href="http://drupal.org/node/289">aggregator</a>, <a href="http://drupal.org/project/cck">cck</a>, <a href="http://drupal.org/project/views">views 2</a> and <a href="http://views-help.doc.logrus.com/help/views/analyze-theme">view theming</a>.</em></p></blockquote>
<p>Its too bad that while the Drupal community is fantastic, there really needs to be some more thought and effort to formalize some good introductory materials to ensure that new folks get ample opportunity to quickly see the pros and cons of the Drupal platform. Of course the community response is &#8220;if you feel strongly, then do something about it.&#8221; Very true!</p>
<p>Just my 2 cents. I&#8217;m certainly biased on Drupal but realistic about the user experience. I continue to find organizations we interact with being confused, lost and at times frustrated with the administrative user experience. Some of this is core Drupal, some is on the module developer, and some is on the implementer. Between us all, we have made big improvements but there is plenty of room to grow.</p>
<p>Blessings all.</p>
<img src="http://blog.tech4him.com/?ak_action=api_record_view&id=178&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.tech4him.com/2009/01/dont-dump-drupal-it-is-powerful/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
