Undefined Variable: title

Notice: Undefined variable: title in include() (line…..

I came across the aforementioned issue while developing a custom Drupal template from scratch; I will post a link to the final work later on.

The consequence was that the block’s title was not displayed even if the title has been set in the admin panel. This issue normally arises from block.tpl.php and can be solved by using the following Drupal HTML5-based code (original Drupal block template code):

<section id="<?php print $block_html_id; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>>
  <?php print render($title_prefix); ?>
  <?php if ($block->subject): ?>
    <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
  <?php endif;?>
  <?php print render($title_suffix); ?>
  <section class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>


July 14, 2014

Posted In: Information Technology

Tags: , ,

Leave a Comment

Customization of “Submitted by” Node Field

When a user posts a new node content, by default there’s data below the title that provides info on the user who posted the content and the date on which it was posted. For example:

Submitted by Admin on Sat, 11/09/2013 – 21:05

Personally it took me a while to understand how this field could be customized for example to “Posted by Admin on 24 Mar 2014”. The customization involves:

  • template.php
  • a pre-processor function (which is placed in the template.php)
  • PHP date() function – it would be great if you had deeper understanding of this function. Just head over to PHP.NET for more info on this function.

In this case, I used Bartik as my template; the default template for any Drupal 7 installation. The pre-processor function used is the theme pre-processor for the node i.e.

function bartik_preprocess_node(&$variables) {


All pre-processor functions are housed either in Continue reading Customization of “Submitted by” Node Field

June 19, 2014

Posted In: Information Technology

Tags: , ,

Leave a Comment

Wi-Fi Repeater

I was recently tasked with boosting the Wi-Fi signal within the office premises. The primary Wi-Fi source was 10 m away from the office and within a separate building. The device was in a small study room and about four walls stood between us and the device hence a low signal reception. Two solutions presented themselves:

  1. Buy a Wi-Fi repeater
  2. Use an existing Wi-Fi router as a repeater

Solution no. 2 seemed better in the long run as it made both economic and scalability sense i.e. the router can be different modes unlike a repeater which, once bought, remains a repeater. I had two Wi-Fi routers, a Cisco Linksys and a TP-Link.


The Cisco Linksys E900 was the original router connected to the ISP modem but I replaced it with the TP-Link one since it was more powerful in terms of signal range. The Linksys would therefore act as a repeater. But I would bridge both routers without the use of an Ethernet cable since both devices were located in two separate neighbouring buildings. The solution was to create a wireless bridge as explained in this article.

However, the firmware loaded on the Linksys router did not have the option of creating a repeater. This limitation prompted me to do more research and I come across an open source firmware called DD-WRT for routers and embedded systems; this firmware supports Repeater mode for routers as indicated on this blog article. There’s a database list for supported devices; the E900 is on the list and therefore I followed the instructions at this link.

I followed the instructions to the letter since any mistake would have bricked the device. So ensure that when you’re flashing your router with a new different firmware, your device type/ model is supported.

May 20, 2014

Posted In: Electronics, Information Technology

Tags: , ,

Leave a Comment

Display $tabs based on Role Type

drupal_branding_2012I came across an issue today whereby questions created by a certain user were editable by other users. The ‘view’ and ‘edit’ tabs were visible but the preference was that they would only be visible to the creator of the question. I checked the permissions page (admin/people/permissions) but everything was okay since each role could edit its own content but not all content.

To solve this problem I made use of the following code:

global $user;
if ($node->;uid == $user->uid || in_array(‘administrator’,$user->roles)){
if ($tabs = render($tabs)): ?>;

<!–?php endif; } ?–>;

This code simple says the tabs will be displayed if the current logged in user is the creator of the question node or is the super administrator. This code can be used for other kinds of content types.

April 28, 2014

Posted In: Information Technology

Tags: ,

Leave a Comment

Create Node Template

drupal_branding_2012By default, all Drupal themes have a default node template. But you can create individual custom node templates based on the content type. Creating one is quite easy. Just duplicate the node.tpl.php file and rename it by adding the machine name of the content type i.e.


For example if your content type is Resources then the machine name will be resources:


Please note the two hyphens that precede the machine name.

For further reading:



April 28, 2014

Posted In: Information Technology

Tags: ,

Leave a Comment

Custom page.tpl.php Template

How do you create a custom page template based on content type for a Drupal 7 site? Simply start from the page.tpl.php, the Drupal default page template. The process of creating a custom page template involves:

  1. Renaming the template file
  2. Creating a pre-processor function
  3. Clearing cache

Renaming the template file

In this step, you add the machine name of the content type to the file name i.e. page.tpl.php:


Create Pre-processor Function

This function is placed in template.php as follows:

function themename_preprocess_page(&$vars, $hook) {
if (isset($vars[‘node’]->type) && !empty($vars[‘node’]->type) && ($vars[‘node’]->type == ‘content_type_machine_name’)) {

$vars[‘theme_hook_suggestions’][] = ‘page__’ . $vars[‘node’]->type;

Replace the ‘themename‘ and ‘content_type_machine_name ‘with your own values i.e. the name of your theme and the content type respectively.

Clear Cache

Clear cache under admin/config/development/performance to allow for the reloading of template file.

April 23, 2014

Posted In: Information Technology

Tags: ,

Leave a Comment

Is WordPress in Trouble?

Another interesting post I discovered through the previous Reddit discussion I have posted on the most previous post. Is WordPress in a dire state?


More discussion on the same issue by the same author of the above article:


Update (1:04pm EAT, 17th April 2014):

So what I’m getting from these discussions is that WordPress architecture really sucks. Well I’m not a pro WordPress developer but from what I’ve seen so far during my time customizing WordPress sites its true. Development and design should be separate but developers and designers usually access the same files. A recommendation by the author of the “The Dire State of WordPress” is that Automattic, the owners of WordPress, should adopt the PHP MVC framework to make the code base manageable  i.e. put functions and visuals separately. I will do more research on this and see how this can be adapted.

April 17, 2014

Posted In: Information Technology, Random Stuff

Tags: ,

Leave a Comment

Money Matters

Two weeks remaining and Mizizi is about to come to an end. My reaction?

Crying baby
Source: Google Image Search

Its been an awesome time meeting new friends, connecting and starting a new family in Christ. And looking forward as we start off as a LifeGroup (LG) after Mizizi. The past 8 weeks has been life changing  and God has used this gift to change my perspective of Him, life and how I live to serve others for His purpose.

One of the key events of the programme was Money Matters that was held at Continue reading Money Matters

March 27, 2014

Posted In: Bible Stuff, Leadership, Unashamed

Tags: ,

Leave a Comment

Disable Drupal Admin Overlay

The admin back-end of Drupal 7 usually makes use of an overlay to display administration content. The overlay is an admin page that displays above the main web page, a way of reducing distraction and make it look ‘hip’; administration doesn’t have to be boring. But for my case it was a distraction because at times the overlay does not load after clicking a link. For instance, I was trying to rebuild permissions for node access permission but this action was rendered incomplete during the process because the overlay page did not load fully.

Solution: I simply disabled the overlay module under the modules page. The module is found under the core modules section. Of course I was able to rebuild permissions without a hitch. Some things are just good for aesthetics; but get rid of them if they do not offer any productive value.

March 13, 2014

Posted In: Information Technology

Tags: ,

Leave a Comment