<?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; theme</title>
	<atom:link href="http://blog.tech4him.com/tags/theme/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>CMS Made Simple &#8211; Photo Album module and CSS Layout Issue</title>
		<link>http://blog.tech4him.com/2008/11/cms-made-simple-photo-album-module-and-css-layout-issue/</link>
		<comments>http://blog.tech4him.com/2008/11/cms-made-simple-photo-album-module-and-css-layout-issue/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 00:29:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[cms made simple]]></category>
		<category><![CDATA[cmsms]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Was helping someone work out an issue with a layout issue on a website running on <a href="http://www.cmsmadesimple.org/" target="_new">CMS Made Simple</a> content management system. Honestly, I've never used CMSMS. After a bit of looking around, it seems like a great little, page based cms. 
]]></description>
			<content:encoded><![CDATA[<p>Was helping someone work out an issue with a layout issue on a website running on <a href="http://www.cmsmadesimple.org/" target="_new">CMS Made Simple</a> content management system. Honestly, I&#8217;ve never used CMSMS. After a bit of looking around, it seems like a great little, page based cms. </p>
<p>Of course, I&#8217;m used to more platform based solutions like <a href="http://www.dotnetnuke.com" target="_new">DotNetNuke</a> and <a href="http://drupa.org" target="_new">Drupal</a>. Platforms meaning they are a starting point with core functionality that you build on. CMSMS has some of that with add-on modules, templates and tag replacement capabilities. Interesting to say the least.</p>
<p>One thing to note, the way that images, files, links, etc.. are managed in CMSMS is fantastic. Especially when you see how easy they are used inside the TinyMCE WYSIWYG editor. Great implementation here&#8230;.Drupal community, take note! <img src='http://blog.tech4him.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Anyhow, this CMSMS installation was using the <a href="http://themes.cmsmadesimple.org/Full_Themes.html" target="_new">hgsunset theme</a>. This is a dark CSS based theme with a menu on the right. Problem was that on the photo album page (generated by the photo album add-on module) the menu was pushed below the body content and to the left. </p>
<p>For the life of me I could not see the problem in the CSS. Firebug failed me there. <img src='http://blog.tech4him.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  Oh well&#8230; a bit more playing and a solution was found.</p>
<p>In the &#8220;default&#8221; photo album template are two script tags that bring in the thickbox and jquery javascripts. Removing them (or actually commenting them out) and place them in the hgsunset template in the &lt;head&gt; section worked like a charm. The script tags were cause a break in the layout so that the menu was no longer pushed right by the body content.</p>
<pre>
<font color="#2040a0"><strong><font color="4444FF"><strong>&lt;</strong></font><font color="#2040a0">script</font> <font color="#2040a0">type=</font><font color="#008000">&quot;text/javascript&quot;</font> <font color="#2040a0">src=</font><font color="#008000">&quot;modules/Album/templates/db/js/jquery.js&quot;</font><font color="4444FF"><strong>&gt;</strong></font></strong></font><font color="#2040a0"><strong><font color="4444FF"><strong>&lt;</strong></font><font color="#2040a0">/script</font><font color="4444FF"><strong>&gt;</strong></font></strong></font>
<font color="#2040a0"><strong><font color="4444FF"><strong>&lt;</strong></font><font color="#2040a0">script</font> <font color="#2040a0">type=</font><font color="#008000">&quot;text/javascript&quot;</font> <font color="#2040a0">src=</font><font color="#008000">&quot;modules/Album/templates/db/js/thickbox.js&quot;</font><font color="4444FF"><strong>&gt;</strong></font></strong></font><font color="#2040a0"><strong><font color="4444FF"><strong>&lt;</strong></font><font color="#2040a0">/script</font><font color="4444FF"><strong>&gt;</strong></font></strong></font>
</pre>
<p>I figured I&#8217;d post this solution so that anyone else running into this issue on that platform might be able to help themselves.</p>
<p>Ah&#8230;fun stuff and I got to play in a new CMS. What fun.</p>
<img src="http://blog.tech4him.com/?ak_action=api_record_view&id=31&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.tech4him.com/2008/11/cms-made-simple-photo-album-module-and-css-layout-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Theme a Content Type</title>
		<link>http://blog.tech4him.com/2008/01/how-to-theme-a-content-type/</link>
		<comments>http://blog.tech4him.com/2008/01/how-to-theme-a-content-type/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 19:55:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Links/Resources]]></category>
		<category><![CDATA[cck]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[drupal 5]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[]]></content:encoded>
			<wfw:commentRss>http://blog.tech4him.com/2008/01/how-to-theme-a-content-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
