Factory Interactive is extremely pleased to be a co-organizer and Platinum Sponsor of this year's Vancouver Drupal Business Summit. The event, happening on June 1, 2012, is a one-day event offering business leaders and managers insight into Drupal's capabilities as a versatile, business solutions framework. Drupal, one of the Internet's most widely used open source content management systems, has evolved into a platform able to support very complex websites and applications.
I love hacking on Linux. All the languages and frameworks that I learned to program with work with run natively on Linux: Python, PHP, the usual suspects.
Since I made the move back to Mac two years ago, I've used my old Toshiba Satellite laptop (2007) to experiment with different Linux distros. I've installed versions of Redhat (which is a lot easier to intall than it was in 2004!), Debian, and Ubuntu. And I've enjoyed them all, especially Ubuntu.
But what I noticed in the latest upgrade to Ubuntu 11.something is that the OS is heavy and clumsy, maybe even a little fat. Fat == slow. Install it and see for yourself. It ain't what it used to be. So, I decided to look for something that fights in a lighter weight division. I need a faster interface.
With more than 250 actively maintained distributions available today, we have a lot of options of Linux to consider. Some of them are more evolved than others, and some are very specialized, but we think that these two are the next ones to try in our search for Linux lite:
!# CrunchBang
Based on Debian, CrunchBang evolved later than other lightweight derivative Linux distributions such as Xubuntu and Lubuntu. With a download size of just under 700MB, CrunchBang includes an impressive collection of software in its basic install.
CrunchBang is built almost entirely from packages available in the Debian repositories and has excellent compatibility with a huge range of software. And since I'm familiar with Debian, Ubuntu and its derivatives then CrunchBang is an obvious choice. And we like the look of it's interface.
Puppy Linux
The Puppy Linux distro runs completely in RAM, and should be compatible with decent selection of older hardware (often an issue with built-from-scratch distributions). Apparently, the software choices aren't enormous, but since my only concerns in using Linux these days are to write code, find things on the web, and type stuff, it fits the bill.
End note
While we were hunting down distros to try, we happened upon a rather interesting version of Linux for all those interested in talking a walk on the dark side: Ubuntu Satanic Edition.
There have been many occasions on which I've wanted to copy all the sub-directories and files from one directory to another directory on the command line, but I didn't want to copy the containing directory itself. I was frustrated in trying to do this using the 'cp' command, but I was finding that when I typed
cp -r directory-a/ directory-b
it would copy directory-a and its contents to directory-b, not just the contents like I wanted.
The trick is to 'cd' into the directory of the contents you want to copy into another dir and type:
cp -apv . /path/to/directory-b
That will achieve the result you want while preserving the original files permissions and ownership in the process.
Skip the windy preamble and go straight to the solution
The Problem
Sometimes it's troublesome to hide or remove page node titles in your Drupal theme. Too often the proposed way to hide page titles is clumsy and inflexible, effecting every content type on the site.
One of the things that's always been a bit finicky about using Drupal for us has been how to control page node titles at the content type level.
Until recently, we were aware of only a handful of ways to hide the default titles that most Drupal themes display for nodes automatically. Sometimes, if not most of the time, we didn't want those titles to appear because they either conflict with the proposed site architecture or we have some other reason for wanting to supress them. As easy as it is to rip out the code that displays titles from the page.tpl.php template, that approach prevents the title from appearing on any page of the site. The same goes for CSS related solutions like the display:none; option.
And there are other arduous., clumsy ways to achieve the effect too:
- How to Make Optionally Hidden Node Titles in Drupal (Using CCK): Drupal 6
- Hide the Node Title on a Page (6.x): Drupal 6
- Hiding Node Titles: Drupal 6
You could even get into your template and add a little conditional code or some form or another, to display titles only for certain pages, but you'd better know a little php; not the solution for everyone.
But what about cases where you don't want the titles to appear for say, a Basic Page content type or whatever, but you do want titles for your Article content types like blog posts and news items? Then you need something a little more elegant, a little more flexible and controlled.
The Solution
The Omega theme allows site admins to toggle page titles for display on their sites, as other themes likely do. And if you design your content layouts using Display Suite, then you have the perfect combination for controlling page titles with flexibility and ease.
The winning combination for hiding page titles in Drupal is the Omega Theme and Display Suite. Display Suite is an indispensible module for controlling how your content is rendered on your site for different layouts. While we've been using the Omega Theme for most projects recently and know it best, this solution will likely work with any theme that allows admins to toggle page titles on and off.
Here's how we've been gaining control over our page titles in recent:
- Download and install Display Suite for Drupal and enable it. Do this using Drush. If you don't use Drush already, there are few things I'd recommend more to a new (or veteran) Drupal developer than to learn to use this tool.
- Turn off the Page Title display in your theme's settings. If you're using the Omega Theme, go to Appearance > "Your site sub-theme" Settings > Toggle advanced elements and deselect Page Titles if selected. This will turn off the Page Title display for all content type nodes on the site by default.

- Go to the Manage Fields area for the Content Type for which you wish to show page titles.

If you want to set different displays for different view modes, like Full Content, RSS, or Teasers, select those under the "Custom display settings" tab and click Save. Then select "Layout for content type in default" where content type is the type you're modifying and default is the view type. For example, if you're modifying the display for Articles in Full Content, the tab title will read "Layout for Article in Full". Select a layout from the dropdown menu, then click Save again.

- After saving, the Manage Display page should allow you to drag and drop fields to be displayed for that content type and display. You'll be able to modify settings in much the same way you can when creating views in the Views UI module. Make sure that Title is one of the enabled fields, then click Save.

- Have a look at a node for that content type on the front side of the site to see if the page title appears, and style to taste.
This is a much, much more civilized method of controlling page titles than performing template surgery to remove titles like some kind of unwanted appendage. What's more, you now have control over what kinds of content will display page titles, and you can even assign them custom CSS classes and turn them into links too, if they're part of a list view for example.
Happy Drupaling!
Factory Interactive is a Drupal development company based in Vancouver, BC, Canada.
Drush is a command line tool that makes creating, managing and maintaining your Drupal installation and its modules remarkably fast and efficient.
If you don't use the command line in the course of your web development work, spend the time to become familiar with some basic commands. Not only will it save you untold amounts of time and effort, it'll make you feel like a hardcore hacker.
As is often the case, jobs sometimes require installing and developing your Drupal site on a shared environment that you don't have root permissions for. While installing Drush on a server you have full control of is fairly straighforward, installing on a shared environment takes a few more steps.
Let's dive right in and see what's involved.
Prefatory note: If your web host doesn't allow shell access to its shared servers, you're out of luck and should think about using a different host. Yes, really.
Installing Drush
- Open a terminal window (or terminal emulator in Windows), log in to your server, and browse to home directory of your account. Type the command:
ls
and press Enter to see the contents of the current folder. You'll know you're in the right directory if you see /public_html or /www in the list of files and folders. If not, change to the level above by entering:
cd ..
That will take you up one level in the directory structure. Repeat that process typing 'ls' each time, until you see you're in the right directory.
- Look for the /bin directory. This is usually created by default with shared accounts, and contains the commands and utilities that you use to work on the server. When you see /bin listed, change to that directory by typing:
cd bin
If it's not there, create it by typing (at the prompt):
mkdir bin
- Change directories so that you're in the newly created folder, again using the
cd
command, and download the tarball of latest version of Drush by typing:
wget http://ftp.drupal.org/files/projects/drush-All-versions-x.x-xxxx.tar.gz
The file name of the tarball might be different, but you can find the latest version of the project at http://drupal.org/project/drush.
- After the tar file downloads, extract it by entering:
tar xzvf drush-All-versions-x.x-xxxx.tar.gz
Then delete the tarball by entering:
rm drush-All-versions-x.x-xxxx.tar.gz
- Change to the /drush/ directory by entering:
cd drush
and then enter:
chmod u+x drush
This ensures the drush file has the permissions is needs to be run when it's called.
- So that we don't have to write out the full path to the Drush executable each time we want to use a Drush command, let's create a path to the Drush executable by making a path link. First, make sure you're still in the Drush folder and then type:
pwd
The path to the current directory will be printed for you. Copy the path, which might look something like
/home/bin/drush/
and then execute:
export PATH=$PATH:/home/mysite/bin/drush
- Check that Drush has been successfully installed, and your link created by entering:
drush
on the command line. If you see a list of all the Drush commands listed on the screen, you're ready to roll with Drush!
Resources
I'd drop out of the device race.
Well, first I'd arrange for the disappearance of the other CEO. And then I'd drop out of the device race.
Except, perhaps, to offer the best keyboard components for handhelds in the market.
But frankly, no one that I've talked to cares about BlackBerry much. They don't care if the BlackBerry Playbook supports Flash or not. Flash is dead, the Playbook was stillborn, and the Blackberry smartphone is in palliative care.
So, now that I'm CEO and I have much less to worry about now that I'm not blowing millions of dollars on researching and developing second-string hardware (and an OS that no one wants and that developers won't develop for), I can focus on the thing that my company does best: developing secure enterprise level messaging and transaction platforms.
The mobile market is colossal. RIM already knows how to implement enterprise level services. Enterprises will need more innovative systems and subsystems to support their information and communication needs across devices.
If RIM opens the door wide, real wide, and creates SDKs and APIs for the BlackBerry Enterprise Server that hook into Google's mobile platforms (and Apple's if they can make the deal), times will get better.
Magento is a deep, sophisticated e-commerce platform capable of enterprise level performance. While no system could ever be deemed perfect, Magento is a very well designed system that gives any organization the ability to set up elaborate product configurations. But that complexity can also make bug hunting a little tricky sometimes. Here's a recent case where figuring out why products were disappearing from the front end of a Magento site after updating them took some real work.
Last week we got a call from a business owner frustrated with a chain of events that forced him to change web hosts. In the process of migrating his site, something went wrong. Once the site was up on the new host's server, any time he changed and updated any of the products through the Magento control panel the products would disappear on the front of the site. By the time he'd come to us with his problem, he'd worked with a handful of people to troubleshoot the issue but no one could determine what was wrong.
The problem
The problem, simply put, is that when products were updated or reindexed in the Magento control panel, they would disappear from the front of the site when browsing by category. You could navigate to items and see them by entering a specific item's URL, but they weren't appearing in their respective categories. We tried many tips and bits of advice. We:
- Checked inventory levels
- Reindexed our product lists
- Flushed the caches through the control panel
- Emptied the /var/ cache files on server
- Ensured the products were enabled in the product configuration
- Ensured the products were visible in the product configuration
- Checked that products were in the right categories in the cp
Nothing. Damn it, we were thinking, how far are we going to have to go to find this one?
The solution
Chris Boyd, Factory's systems engineer, embarked on a trace/reduction style process that involved the following steps. He:
- Drilled down to the first SQL statement and found it was indeed returning the correct number of products
- Determined that the SQL for filtering the products was completely filtering out all the results
- Looked at the SQL a little closer and noticed it was JOINing based on customer group "0"
- Removed the JOIN we discovered that the products showed up as they were supposed to. Restored the JOIN
- Checked the customer groups to ensure that there was, in fact, a group with an ID of "0". No group with ID = 0
- Saw that "not logged in" had an ID of "4"
- Compared "not logged in" ID to other Magento installations and discovered it was "0"
- Updated "not logged in" group ID to "0" on our problem site and everything returned to normal
We're not exactly sure what caused the problem in the first place since the data we were working with had already been exported from the original working site's database before migration.
The final word: if all other troubleshooting efforts fail, check to see that the "not logged in" group ID matches the JOIN in the product lists generated by the SQL query.
The files & methods
Here's list of the files and methods checked in the process outlined earlier: Magento ver. 1.4.0.1
- app/code/core/Mage/Catalog/Model/Layer.php getProductCollection() method, line 101 // gets the products for the current category
- app/code/core/Mage/Catalog/Model/Category.php applyProductLimitations() // gets the product collection for the current category
- app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php, line 1283
defined in

Comments (0)