Apr
13

The joys of drupal

About one month ago we started building out the collection of sites for our newly formed company. My original intention was to use Wordpress combined with some pluggins as the software foundation for the sites. After checking into drupal, we decided to use it and thus far our experience is really quite positive.

I've got experience with a number of different content management systems including Wordpress, Lifetype, Pligg, EZPublish and a long time ago PHPNuke. None of this experience other than Wordpress and Pligg is very fresh so keep that in mind when I say that I am very impressed with what drupal offers.

If you want to do something a little custom with it, there probably a module you can install to accomplish it. Installing modules is a snap, just grab the tarball, toss it in your modules directory unpack it and then turn it on. It really couldn't get any simpler.

We are using a lot of additional modules with our systems, from a simple module to customize the look of the standard search box to a module to help us weed out the comment spammers. Digging in to get it to something a bit unique is also quite easy. One small example is the display of shoes that is included on http://www.shoeidiot.com/.

We wanted to show 6 shoes on the index page in two columns with specific information. To do that we created a page and slapped some simple PHP code into it and we got exactly what we wanted. Nice and easy. Here's the code we wrote:


function print_front_page() {
}

$node_type = 'shoe';
$list_no = 6;
$sql = "SELECT n.nid, n.uid, n.title, s.field_description_value, s.field_buyurl_value, s.field_imageurl_value, s.field_price_dec_value, s.field_programn_name_value
FROM {node} n
INNER JOIN {content_type_shoe} s ON n.nid = s.nid
WHERE n.type = '%s' and n.promote=1
ORDER BY n.title DESC";
$result = pager_query(db_rewrite_sql(sprintf($sql, $node_type)), $list_no);
$left=TRUE;
while ($node = db_fetch_object($result))
{
$temp2=check_plain($node->field_programn_name_value);
$temp=str_replace(" ","_",$temp2);

if ($left ==TRUE) {
print "";
print "field_imageurl_value." height=75 align=left vspace=10 hspace=10 alt='".$node->title."'>";
print "";
print l($node->title, "node/$node->nid");
print "";
print "
field_buyurl_value.">field_programn_name_value.">";
print "
";

$CharCutOffLength = 200;

if(strlen($node->field_description_value) > $CharCutOffLength)
{
$DescripTemp=substr($node->field_description_value, $CharCutOffLength,strlen($node->field_description_value));
$space=strpos($DescripTemp," ");
$space+= $CharCutOffLength;
$TheNewDescrip=substr($node->field_description_value,0,$space);
print "$TheNewDescrip"."nid.">...read more.";
}
else
{
print $node->field_description_value;
}

print "

";
print "$".$node->field_price_dec_value;
print "";
$fivestarwidget = fivestar_widget_form($node);
print $fivestarwidget;
print "";
print "";
print "";

$left=FALSE;
}
else
{
print "";
print "field_imageurl_value." height=75 align=left vspace=10 hspace=10 alt='".$node->title."'>";
print "";
print l($node->title, "node/$node->nid");
print "";
print "
field_buyurl_value.">field_programn_name_value.">";
print "
";

$CharCutOffLength = 200;

if(strlen($node->field_description_value) > $CharCutOffLength)
{
$DescripTemp=substr($node->field_description_value, $CharCutOffLength,strlen($node->field_description_value));
$space=strpos($DescripTemp," ");
$space+= $CharCutOffLength;
$TheNewDescrip=substr($node->field_description_value,0,$space);
print "$TheNewDescrip"."nid.">...read more.";
}
else
{
print $node->field_description_value;
}
print "

";
print "$".$node->field_price_dec_value;
print "";
$fivestarwidget = fivestar_widget_form($node);
print $fivestarwidget;
print "";
print "";
print "";
print "";
$left=TRUE;

}

}

print "";
print theme('pager', NULL, $list_no);


My php skills are not what anybody would call advanced. I know enough to be able to poke around and understand what code is doing and then to dig around php.net for the syntax of the functions I want to use. So please don't snicker about the quality of the code I shared. If you've got some feedback on how I can improve it, I'm certainly looking to improve those skills.

With the robust community and the number of modules and themes, you don't have to be a php programmer to be able to create a unique site. Certainly having at least some rudimentary php skills will be a big help but even without them you can have success building a full featured site using drupal.

As we continue to work on our collection of sites and implement new features and hacks, I'll be sharing them. So far I'm pleased with the choice. I hope I stay pleased.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.
Powered by Drupal, an open source content management system