development
Provisioning and install script for a speedy Drupal workflow
Posted March 28th, 2009 by Caleb GI made this script and the database backup, dump, and SVN commit script because I was determined to spend as little time as possible doing sysadmin while setting up dev and staging sites, so that I could spend as much time as possible developing (e.g., the fun stuff). With one command the script can:
- 'svn up' a version controlled database, and upload it to your database
- Run queries against database to set preferred site defaults
- 'svn up' site docroot
- Copy over fresh "files" directory from another site (e.g., production). Note, not a good option if you have your "files" directory version controlled.
- Set owner:group file permissions on all site files
Three little lines of code that you may learn to love
Posted March 22nd, 2008 by Caleb GAssignment: Create a highly customized page/node in Drupal and:
- Be able to develop the page/node using our text editor of choice and avoid the time-consuming and not-intended-to-be-developer friendly Drupal node-editing interface
- Optionally be able to decide whether to have the page/node be editable by the via the Drupal UI or not.
Sure, we could do this by creating a page-node-xx.tpl.php template file (where 'xx' is the node id number), but that's just a major hassle later on when updating/theming things and it won't give us the flexibility of being able to let an end-user edit things.
In this case, the thing to do is to create a file called my-file.php (.php because we want our text-editor to still recognize it correctly), put it in our theme folder, check the PHP input filter on the node itself, and then place this code in a node:
<?php
// Include a file with the rendering of a node so that you can edit in text editor and just refresh without having to use Drupal UI
$filename = 'my-file.php';
$path_to_file = drupal_get_path('theme', 'your_themes_name') .'/'. $filename;
include($path_to_file);
?>What this will do is look for the file you placed inside your theme folder called "my-file.php" and render it. Which means that you make changes directly to my-file.php without having to touch the node itself and thus simply refresh your node anytime you make changes to the file.
This method has the advantage of:
- Saving a ton of time and headaches of dealing with the Drupal interface and doing without your favorite code editing tool.
- After you're finished you'll have the option of choosing to replace the include-code with the final code inside your file so that an end-user can edit it within UI...
- ...or you can just keep things like this and be able to do cool things like check the code into version control, which means that you basically get many of the benefits of a tpl.php file without the cost of one.
Enjoy and happy coding. :-)
UPDATE: if this all sounds like a good idea to you, head over to the project page for Save-to-File which was inspired by a conversation in the comment thread below.
Advanced Theme Construction Kit (ATCK) updated for Drupal 6
Posted March 15th, 2008 by Caleb GThe Advanced Theme Construction Kit, which integrates a derivative of the Yahoo grids CSS library within a Drupal framework, was updated and released for Drupal 6 today.
Dev Mashup: Building a dual MySQL 4.1 and MySQL 5 dev environment in OS X 10.5 Leopard (and more)
Posted February 15th, 2008 by Caleb GI've been wanting to upgrade to MySQL 5 for a while now, and after hearing that MySQL 5 is required for Drupal 7 I decided to bump up my upgrade schedule, pronto. If all one wants is MySQL 5 then that is easy enough -- go download MAMP and you're done. But what if you want to be able to dev on MySQL 4 for projects that require it for whatever reason (e.g., clients who are run it and are not willing/able to upgrade MySQL at the moment)?
Well, with not a lot of effort - it very easy to have a PHP 5, PHP 4, MySQL 5, and MySQL 4.1 environment - all sharing the same doc root and servernames (e.g., urls):


Recent comments
4 weeks 3 days ago
7 weeks 1 day ago
7 weeks 5 days ago
8 weeks 1 day ago
11 weeks 6 days ago
14 weeks 4 days ago
14 weeks 5 days ago
14 weeks 6 days ago
15 weeks 1 hour ago
15 weeks 2 days ago