|
|
|
Archive for the 'Drupal' Category
Friday, July 17th, 2009
Whilst the default Drupal search is ample for most sites, we needed a search system that was faceted, wouldn’t bog down MySQL, and would work on a cluster. There was one clear winner – Apache SOLR.
From the same people that brought you the ubiquitous HTTP server, SOLR is a java search engine that is hugely sophisticated, yet through the joys of Drupal modules, is really easy to set up. Simply grab this module, and follow this guide.
A bit more work is required to really replace the Drupal search. The Suppress Search module completely hides the drupal search, and redirects all searches via SOLR. How about reformatting the SOLR search results though?
Using Drupal hooks, changing how the SOLR search results look is really easy. There are two hooks of interest: hook_apachesolr_process_results() and hook_apachesolr_search_result_alter().
hook_apachesolr_process_results() is called for each item in the search result. It is passed an object containing the raw search result – the node title, search score (relevancy) etc. The node title displayed can be edited to include the relevancy score:
function apachesolr_custom_results_apachesolr_search_result_alter(&$arg)
{
$show_score = variable_get("apachesolr_custom_results_showscore", 'hide');if($show_score == "show")
{
// append score to title
$arg->title .= " [".$arg->score."]";
}
return $arg;
}
hook_apachesolr_search_result_alter(), on the other hand, is only called once. At this point the raw search result from SOLR has been converted to node objects, so all node details are available to tweak. In the code snippet below I’m hiding or showing the author’s avatar next to each result:
function apachesolr_custom_results_apachesolr_process_results(&$arg)
{
// loop through each result, performing desired actions
for($i = 0, $l = count($arg); $i < $l; $i++)
{
$show_author = variable_get("apachesolr_custom_results_hideauthor", 'def');if($show_author == 'hide')
{
// remove user
$arg[$i]['user'] = "";
}
elseif($show_author == 'pic')
{
// show user avatar
$author = user_load($arg[$i]['node']->uid);
if ($author->picture)
{
$arg[$i][’user’] = theme(’user_picture’, $author);
}
else
{
$arg[$i][’user’] = ‘ ‘;
}
}
}
}
To simplify deployment, I’ve made a module enabling some simple customization of the results. Whilst not that useful in itself, it would make a good starting point for further development.
Module Download
Posted in Web development, Tips, php, LAMP, Apache, Drupal, mysql, Drupal modules, Drupal customisation, Drupal development, Drupal scalability, content management | Comments Off
Friday, March 6th, 2009
The favicon is the little icon that usually appears next to the navigation tool bar of your browser.

First of all, you need to create a favcion.
In Photoshop open the icon or logo that you want to use as favicon.
Reduce the size of the icon to 16 pixels by 16 pixels, and save it in PNG 24.
After you save the icon in your image folder, change the name of the file to favico.ico (instead of png).
Then open the website that you are working on, login as admin, go to
ADMINISTER > Themes > Configure



At the bottom of the page you will see a box “Short cut icon settings”.
Browse the file called favicon.ico and upland the file.

Tick off the “default shortcut icon” and save configuration.
Posted in Web development, Drupal, Drupal customisation, Drupal development, Drupal styling, Drupal configuration | Comments Off
Sunday, February 8th, 2009
A customized Drupal module won’t be very useful if the admin user can’t configure it to their needs. This usually consists of several form fields where variables and inputs can be set. Within the module these fields are created within a function, however unlike other common module functions this one is not a hook and does not need a specific function name (although the names are usually along the lines of testmodule_admin or testmodule_settings). The following is an example of the structure these functions can take.
function testmodule_admin_settings() {
$form[‘testmodule_nodeno’] = array(
‘#type’ => ‘textfield’,
‘#title’ => t(‘Number of nodes to include’),
‘#default_value’ => variable_get(‘testmodule_nodeno’, 5),
‘#size’ => 2,
‘#maxlength’ => 2,
‘#description’ => t(‘The number of nodes to display.’),
‘#required’ => true,
);
return system_settings_form($form);
}
No HTML has to be coded to create the form, as this is all done by Drupal. The systems_settings_form function is used to add default buttons and set a form prefix. Note that variable_get is used to set the default value.
However, these settings mean nothing if they don’t interact with how the main module displays its contents. In most cases this involves grabbing information from the database – this information needs to conform to our configuration settings. In this example, we want to limit the number of nodes retrieved to 5.
$nodesmax = variable_get(‘testmodule_nodeno’, 5);
$sql = ‘SELECT nid, title FROM {node}’;
$result = db_query_range($sql, 0, $nodesmax);
To add this page to the sites menu system we must make use of hook_menu. Here we can set the page path, title and permissions.
function testmodule_menu() {
$items = array();
$items[‘admin/settings/testmodule’] = array (
‘title’ => ‘Test module settings’,
‘description’ => ‘Set a node limit to your test module.’,
‘page callback’ => ‘drupal_get_form’,
‘page arguments’ => array(‘testmodule_admin_settings’),
‘access arguments’ => array(‘access administration pages’),
‘type’ => MENU_NORMAL_ITEM,
);
return $item;
}
If you have already installed and enabled your module, it may be worth disabling and enabling it again for the new settings page to work properly.
Resource: http://drupal.org/node/206761
Posted in Web development, Drupal, Drupal modules, Drupal customisation, Drupal development, Drupal configuration | Comments Off
Sunday, February 8th, 2009
Modules are the building blocks for Drupal sites. They’re an easy way to add functionality to your site, and there’s a wide variety to choose from. All modules must include a modulename.info file, which explains descriptive information about the module.
There are 3 required details needed in this file – the module name, a description, and the version of Drupal the module is built for. This should be written as below:
name = Test module name
description = A simple module to test my coding skills.
core = 6.x
Note: in the module name, only the first letter should be capitalised. For the description, apostrophes should be avoided, instead use HTML entities.
There also optional strings that can be included in the .info file. If your module relies on any other modules to work, then these should be included in this file. In the following example, our new module relies on the blog and profile modules.
dependencies[] = blog
dependencies[] = profile
Another optional string is called ‘package’. On the main module list page the blocks are grouped by type for legibility. The idea is to place your module alongside similar modules to make it easy to find. For example, if you module involved video, then you could place with other video modules by using the following code:
package = “Video”
Posted in Web development, Drupal, Drupal modules, Drupal development, Drupal configuration | Comments Off
Sunday, December 28th, 2008
The British Council’s educational social network site - English Online (http://www.englishonline.hk/en and http://m.englishonline.hk/en (mobile version)) has now almost 90,000 registered users! (88,460 registered usesr at the current time of writing on 28th December 2008).
Well done to Andy Newton and the English Online team at the British Council… at this rate of growth the site will have over 100,000 users in early 2009!
English Online was built using Drupal by Brightlemon. To find out how to use Drupal and social networking concepts to power your projects - contact Brightlemon today…
Latest Members
There are 88,460 users on British Council - English Online.

Posted in Brightlemon news, Web development, social networking, Web 2.0, Drupal, Drupal Themes, Drupal modules, Drupal customisation, Drupal development, case study | Comments Off
Friday, November 28th, 2008
Below are some examples of websites that use Drupal’s successful framework.
Music organisations such as MTV UK, Warner Brothers Records and Sony BMG.

Individual record artists websites - Bob Dylan, Grateful Dead, Ozzzy Osbourne, Avril Lavigne

Non Governmental Organisations - amnesty International and End Poverty 2015

Sites which benefit from advance Drupal functionality - Spread Firefox & Yahoo research


Posted in Web development, e-commerce, Drupal, Drupal Themes, Drupal views, Drupal regions, Drupal development, Drupal video, Drupal training | Comments Off
Friday, November 28th, 2008
British Council - English Online
Please visit the site at www.englishonline.org.cn
About the British Council

The British Council connect people with learning opportunities and creative ideas from the UK to build lasting relationships around the world.
Brightlemon were asked to design and build a community based website (English Online) to help promote the learning of English in China.
Visit the British Council’s English Online social networking website external link
The requirement
Design, creation and implementation of a complete educational social networking site to assist Chinese students in learning the English language.
The following list summarises some of the features of the site:
Personalised newsletters
Like many websites, users can sign up for a html newsletter from English Online to be delivered to their email inbox.
However what is unusual about English Online is that the actual content of the newsletter delivered is tailored to each user’s specific interests and learning level.
This is achieved by sophisticated taxonomy techniques which matches content with users based on their learning records and achievements, user role (learner, teacher, school) and other profile information.
Personalised content
One of the main requirements for the English Online site was that each user would be able to create their own ‘profile’ (similar to that which might be found on sites like myspace, facebook etc.) as a virtual toolbox for their study of the English language.
As they work through exercises, lessons and exams on the site, their progress is stored within this profile along with records of all other activities they have been involved in within the website (blogs, forum posts, pictures shared with other users etc.)
Users can choose from various pre-made templates to theme their profiles.
There are even different templates available for different user groups such as Learners, Teachers and Schools.
Personal blogs

Blogs provide commentary or news on a particular subject; some function as more personal online diaries. A typical blog combines text, images, and links to other blogs, web pages, and other media related to its topic. The ability for readers to leave comments in an interactive format is an important part of many blogs. Most blogs are part of a wider network of social media.
For the English Online website each user has their own indivual blog - presented within their user profile page.
Multiple languages

Obviously with the website primarily aimed at Chinese people wanting to learn English it was imperative that users of all skill levels would be able to access and understand the information and content presented.
For this purpose the site content needs to be available in both Chinese and English, but not only that as there are two main forms of written Chinese (traditional and simplified) and both of these are needed.
So brightlemon implemented a system where the user can instantly change the language of the site from any one of these three languages to another with one simple click of a mouse, no matter what page they are on.
Streaming videos

Forums

An Internet forum is a web application for holding discussions and posting user generated content. Internet forums are also commonly referred to as web forums, message boards, discussion boards, (electronic) discussion groups, discussion forums, bulletin boards or simply forums.
The forums on the English Online site provide a valuable discussion point for students, teachers and school administrators, where they can share advice and experiences with and ask questions of other English Online users.
Online Polls

Another point of interactivity is web based polls where users can vote on specific questions and share the automatically collated results.
Multiple Colours - Customisable Interfaces

To truly personalise the user experience people can also instantly change the colour scheme of the entire website by simply clicking a tab in the site’s ‘colour chooser’, which sits top left of every page.
Mobile site development

English Online has a dedicated theme that is designed for mobile phone users. This theme is set as the default when accessing the site via http://m.englishonline.org.cn/ - view mobile demo via Opera mobile. This simplifies the site display so it can easily be used via a phone’s smaller and more limited browser. Figure M1 shows how the latest members block is displayed via the Opera Mini browser, one of the most common mobile browsers.
Widget development


Widgets provide a way for users to actively participate in a website without the need of opening a web browser. Using Adobe Flex technology, widgets can be created that run on a variety of different platforms, giving users access to diverse rich media content.
For EnglishOnline.org.cn, a widget was created in order to provide a personalized user environment for all registered users. This environment allowed users to be able to quickly check the site for updates. Figure W1 shows the widget displaying the latest blog posts on the website.
Further than just being able to show updates to the website, the widget also enabled users to interact with their account.
Many of the web 2.0 features of the website were accessible through the widget. For example, the widget allowed users to check their friends list, read their messages (see Figure W2) and access their profile.
Widgets created with Adobe Flex technology can be seamlessly connected to the Drupal 6 framework, allowing for simple and fast viewing of data and media.
Posted in Brightlemon news, Web development, Internet Security, Web design, Accessibility, e-commerce, Web browsers, Open Source, Flash, social networking, social bookmarking, social tagging, php, Web 2.0, Web video, Linux, LAMP, Illustrator, Quality Assurance, Web standards, CSS, W3C, Dreamweaver, maths, Drupal, javascript, mysql, Errors, FTP, Firefox Add-Ons, Drupal Themes, Drupal views, Drupal regions, Drupal modules, Drupal customisation, Drupal development, Drupal optimisation, Drupal scalability, Drupal styling, Drupal video, Drupal configuration, Blogs, Web marketing, Drupal training, Drupal courses, mobile web, research & strategy, Information Architecture, Usability, content management | Comments Off
Friday, November 28th, 2008
Learn English
Brightlemon has been commissioned to design a pilot website for British Council – Learn English.
The site will be divided into two main sections that will cater to their specific target audience. Learn English Adults (teens, adults, professionals, migrant workers and English exam takers) and Learn English (aimed primarily at children, parents and teachers of children). These two sites, in terms of design, offer two different proposition (see below)
The Learn English website will incorporate the existing sites (Learn English Central, Learn English Professionals and Learn English Kids) into a brand new, fresher and more user friendly design. At present these sites attract more than 900,000 visitors per month.
Learn English Adults
Design and layout
The design aims to highly navigable, modern, light use of graphics and not too much text

Ability to choose languages

Part of the requirement of the brief is that the website should be ‘multi language’. English, Chinese Simplified, Chinese Traditional, Arabic and Russian versions.
-
Help blocks

Profiles and accounts for the new site.

Events Calendar

Multiple navigation options – most popular, recently viewed or polled content.

Look at latest comments and blogs.

Learn English kids
Design and layout
Clear, simple, vibrant, child-friendly, youthful, strong use of colours, simple navigation, images, graphics for navigation, speech bubbles, not too much text.

Main graphic navigation carousel

Content Block styling

Learn English Flash Games

Latest competition module

Login modules

Opinion Polls

Recent comments

Posted in Brightlemon news, Web development, Internet Security, e-commerce, Open Source, Flash, social networking, social bookmarking, social tagging, ssh, Web 2.0, Web video, Linux, LAMP, Photoshop, Illustrator, Quality Assurance, Web standards, CSS, HTML, W3C, Dreamweaver, mathematics, maths, Drupal, mysql, FTP, Drupal Themes, Drupal views, Drupal regions, Drupal modules, Drupal customisation, Drupal development, Drupal optimisation, Drupal scalability, Drupal styling, Drupal video, Drupal configuration, Blogs, case study, Adobe, Design, subversion, Drupal training, Drupal courses, research & strategy, Information Architecture, Usability, content management | Comments Off
Friday, November 28th, 2008
The British Council’s English Online - built by Brightlemon - was recently featured on the home page of Dries Buytaert’s website http://buytaert.net/british-council-using-drupal. For more details about this project see the brightlemon blog.

Posted in Brightlemon news, Web development, Web design, Drupal, Drupal Themes, Drupal views, Drupal regions, Drupal modules, Drupal customisation, Drupal development, Drupal optimisation, Drupal scalability, Drupal styling, Drupal video, Drupal configuration, Web marketing, Drupal training, Drupal courses | Comments Off
Friday, November 14th, 2008
To start, create an account with the Drupal web site at www.drupal.org.

Click on “download” button from the top right tabbed menu, and select “Themes”.

You will see a page full of themes, which you can filter by type (version of Drupal that you are working on etc) using the drop-down at the very top of the page.

Choose a theme (or more than one) that are similar in layout to your design (same number of columns etc.) and download them.

The themes will be downloaded in the format: tar.gz these are compressed files which can be opened with most commonly available zip utilities (winzip etc).
To make your new themes available to your Drupal site they first need to be uploaded to the correct directory:
sites >> all >> themes.
To activate your new theme, login to the admin area of your Drupal site, navigate to site building >> themes and tick the ENABLE check box next to your new theme.
To make your new theme the site’s default (which is that one that you uploaded) tick the radio button next to the check box and click the save button at the bottom of the page.

Posted in Web development, Web design, Open Source, Tips, Web 2.0, CSS, HTML, Dreamweaver, Drupal, FTP, Drupal Themes, Drupal customisation, Drupal development, Drupal styling, Drupal configuration, Design, Drupal training, content management | Comments Off
|
|
|