Over the past week I spent all my time on the website, and developing the theme. A portion of the work is done in the core of the website and the database and there’s nothing to show except explaining the process. But before going into the details, I need to explain the work flow of a drupal website, and I do apologies if there was any confusion last week. However, if this is not necessary, and last week explanation was enough, you can skip this part of my post, and continue after the first heading.
First I need to explain why we are using a content management system with all its complexity and difficulties. We could simply build a HTML/CSS website in a very short period of time, but we needed all the team members to be able to add content to the site. But why Drupal? My answer is because it’s one of the most advanced and powerful CMSs out there, so powerful that whithouse.gov is powered by Drupal. Why not Wordpress? I love wordpress, and its usability, but I consider it as a blog web platform, and it’s great for blogging, managing posts and archives. They are basically two different thing. Drupal can be compared to the other CMSs such as Joomla, Movabletype, Symphony, etc. One of the huge advantages of Drupal is called blocks, and the developers are able to add any type of information as a block to any “region” in their theme. Defining regions in a theme involves PHP coding, and requires a lot of time while developing the theme. The other huge advantage of Drupal over Wordpress is its full control over navigations. If someday the project grows (who knows!!) we can add stuff to it (such as forums or maybe even new pages) easily. Second, I need to explain the process of making a theme for drupal. Basically it is the same procedures as themeing wordpress, but it requires a lot more PHP coding. First we need to make a HTML template for the site, and then we have to convert that template to a PHP page, and finally the template will be break down into different PHP codes that define the Drupal theme. This is why we have two different sites. The first one is the HTML template, and it’s a preview of the future website, and the other one is the actual Drupal site. Once the theme is done, the HTML template is useless.
Below are the brakdowns of previous week:
Template
First thing I did was I converted the template to PHP, and broke it down into static and dynamic elements and replaced the static elements with PHP include command. I also tweaked the theme a little bit more, and added to Hover state to all the navigations on the site. The Architecture of the site is added to the template and you can now navigate through the site. I also introduced the “quick facts” call out that replaces the side nav in every page except the characters page. This call out will provide facts about characters randomly on every page. At the first glance it’s a very simple HTML div, but the height of the call out will vary based on it’s content. It took me a while to come up with a mark up that stretches with the content. the simple solution is to break it down in to top, middle and bottom, but this won’t work properly as I got gaps between each div. The way it is constructed right now, it consists of two DIVs, one for the top with the top ornament background, and the other is the bottom div with a very long background picture that contains both the middle lines and the bottom ornament. Now if the text in the call out is short, the background picture for the bottom DIV starts from the bottom, and you see only the bottom ornament and the portion of middle lines that is necessary. Also when the text is pretty long it will expand up ward and you see the rest of the middle lines. These are all being controlled by CSS. I also redesigned the cycle image gallery and its border and now both the callout and the cycle image gallery matches the template better. You can preview all these changes at:
http://www.lexiconquest.com/template/
Time: 13 hours Percentage: 98% (of the template)
Drupal
I spent some time to activate the “Clean URL” in Drupal (This is pretty easy in Wordpress!) By default, Drupal adds extra characters to the URLs, and if you want to define custom and clean URL, you need to prepare the server for this feature, and add a module call “Path.” Long story to short, in order to turn this feature off, you need to add re-write rules to the .htacess file on the server. After spending some time searching on the net, I found the below code that enables the Clean URL function, and works for our server and BlueHost servers:
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
# If your site can be accessed both with and without the ‘www.’ prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the ‘www.’ prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the ‘www.’ prefix,
# (http://example.com/… will be redirected to http://www.example.com/…)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the ‘www.’ prefix,
# (http://www.example.com/… will be redirected to http://example.com/…)
# uncomment and adapt the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
RewriteBase /
# Rewrite old-style URLs of the form ‘node.php?id=x’.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]
# Rewrite old-style URLs of the form ‘module.php?mod=x’.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]
# Rewrite current-style URLs of the form ‘index.php?q=x’.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
Now all the URLs are clean and free of any extra characters. Then, I spent most of my time developing the actual Drupal Theme. I set up the the Theme Info file, and page.tpl.php using this useful guide, which are two important files in a theme, and they tell drupal the different parts of the template such as header, navigations, content, side navs, and footer, through PHP. For example if the design of the site has two columns, we have to define them in these two files. Drupal theme consists of many CSS files, but the most important ones are the CSS for the front of the site and the other is for the administration menus. That means writing CSS for both the front of the site and the admin page. If we don’t write a CSS for administer menu, you won’t see any of the menus available to the admin. So it’s very important to write a CSS for it before changing the theme, otherwise you are going to lock yourself out! You can only notice this when you log in to the site. I believe Ted already has an account with our site and he can kindly preview these after he logs in to the site. It’s not the best admin theme just yet, an there is still more work to be done, and since it’s not a high priority in designing a theme, I will work on it later in order to make a more user friendly interface for the editor users. make the admin theme even more user friendly later on. In addition to this, I set up regions for header, body, left sidebar, and the footer of the template, and the blocks now can be added to each region as needed. Again, you can preview that when you log in by going to the Administer>Site Building> Blocks, and there you can see that you can actually drag different blocks (right now we have only pre-built blocks by drupal) into these regions. The yellow area in the below pictures show these regions:

The theme is taking it’s basic design, and from this point I need to work on the left side column and the content sections. Lastly I added a new navigation that contains the name of the characters and it is visible only when you go to the characters page. Now we can add the profile pages and parent them to each character within this list. The search function is also added to the, but for now it’s only available when you are logged in as one of the users. When you are logged out the search bar is inaccessible, and I will fix this issue next week.
You can preview all the changes to the theme, clean URL, and the architecture of the site at:
http://lexiconquest.com
Hours: 30 Percentage: 45% (of developing the theme)