Submitted by Dale on March 17, 2012 - 8:47pm
Like many web types I have a number of small websites I look after, and I've never been happy with my backup solution. Until today.
My requirements are simple, create a backup of the database and files and save it on a local backup drive. The sites don't warrant anything fancy (like a cloud based solution that costs money). The procedure until now involved multiple, fussy steps. It turned out a single script solution is simple once a few key technologies are in place.
Submitted by Dale on July 3, 2011 - 8:59pm
Replacing files during a Drupal upgrade can be tedious, especially for those of us who have to worry about SVN files in every directory. The following script automates this part of the Drupal upgrade, making it much faster and less error prone. I've been using the script in its current form for almost a year and it has served me well. And though most of my other bash scripts have been replaced by Drush commands, this script has proven better suited to my workflow than its Drush equivalent.
The script does the following:
- Deletes the current Drupal distribution files while preserving:
- SVN files
- all files in the /sites directory tree
- all files in /files directory tree
(I have a number of sites using the old file directory location)
- the Komodo (.kpf) project file
- Downloads and expands the Drupal distribution tarball if it has not already been done
- Copies the new Drupal distribution files to the target directory
- Removes the unrequired text files. e.g., CHANGELOG.txt, INSTALL.mysql.txt
Submitted by Dale on July 30, 2010 - 3:21pm
An example, like a picture, is worth 1000 words. Until recently Drupal programming examples existed but were spread among documentation pages, blog posts, and the Drupal CVS repository; some searching required. That changed in late 2009 with the introduction of the Examples for Developers module. Its purpose: "to provide high-quality, well-documented API examples for a broad range of Drupal core functionality". Now you can find high-quality, working Drupal 6 and 7 code examples in one place, many with SimpleTests.
Submitted by Dale on July 23, 2010 - 8:16am
Drupal's scripting abilities just keep getting better and better. Since publishing my Drupal Command Line Script Template last year I've moved exclusively to the Drush php-script (scr) command. The script template article still gets a lot of page views - perhaps because with all the functionality in Drush it's easy to miss the scripting feature - so posting an update seems like a good idea.
Drush Scripting Advantages/Disadvantages
The advantages of using Drush over using my original template are:
- Drush takes care of creating the Drupal environment for the script to run in, which is the only function the template served. Using Drush factors out the environment common code, eliminating redundant code in individual scripts.
- Drush makes it easy to place the script files in a directory outside of the Drupal website home directory. Placing script files outside the website home directory eliminates a whole range of security issues.
- The Drush code that creates the Drupal environment is reviewed by the community, making it far more robust than something a single person could create or maintain on their own.
- When the code required to create the Drupal environment changes you don't need to update individual templates, just Drush.
Submitted by Dale on June 23, 2010 - 9:57am
When image-sets are discussed it's usually in the context of a full featured photo gallery, but there's another common use: including a set of images with the content of a node. For example, product images with a product node or a "mini" photo album with an article. The CCK ImageField combined with a jQuery module like Thickbox makes adding image-sets to nodes easy. Here's how.
This "recipe" describes how to add a gallery style photo-set to a node. This photo-set stands apart from the node content as a set of thumbnails which can be clicked on to display the full-size version. The Thickbox slide-show feature is also implemented so viewers are able to step through the full-size version of the pictures without exiting the viewer. Although Thickbox is used, this technique should be easily adoptable to different plug-ins.
An example of the technique can be seen here: Finding the Blue Whale
Submitted by Dale on November 24, 2009 - 8:35am
Anyone who's tried to explain Drupal's content feature-set to the uninitiated appreciates the amount of territory that needs covering as well as the challenges inherent in presentation depth and order. J. Ayen Green takes up the challenge in his book, Drupal 6 Content Administration, published by Packt Publishing.
Submitted by Dale on July 27, 2009 - 1:11pm
Drupal RSS functionality is spread out, and so is information on it. After first accumulating mental notes, which turned into a collection of written notes and code snippets, I realized there's a lot to be said on the topic. A single overview covering all things RSS seemed like a useful idea. This is a starting point covering many things RSS. I invite you to leave a comment if you have anything to add, a great reference or blog post, or if I've gotten something wrong.
"Out of the box" RSS
- RSS is configured and controlled at Administration > Content management > RSS Publishing
- The default RSS URL is rss.xml (e.g. www.example.com/rss.xml)
- The default RSS feed selects content using the same selection criteria as the /node path ("/node" is the default front page setting). It contains the content of any node that's both "Published" and "Promoted to front page".
The exact content and number of nodes is determined by the RSS settings.
- There is no provision to theme a node's RSS output in the PHPTemplate theme engine. Your node.tpl.php file is ignored when the feed content is rendered.
- Because of the above point, double check the RSS feed output of any feed containing nodes you've created or modified with CCK.
- Every taxonomy term automatically gets a feed (whether you want it or not)
- The is no provision in the Drupal base installation (core) to publish comments in a RSS feed. A contributed module (RSS Comments or Views) is required. More on this later on.
- The RSS feed will only be published on the front page. More on this later.
Submitted by Dale on March 30, 2009 - 12:12pm
Putting location data on maps, especially dynamically, used to be a dream. No longer. Thanks to open standards, APIs, Internet based map web services, and many hours of work in the Open Source community, a new wave of options are available for putting location based data on maps. And Drupal is surfing this wave!
Submitted by Dale on March 27, 2009 - 5:54pm
The LinksDB module provides a nice "it just works" way for implementing a classic Links page. The standout feature is its hierarchical display of the URLs. Even after Views and CCK arrived, the hierarchical display was worth staying with the module. Sadly, with a site to upgrade and no Drupal 6 version of LinksDB in sight, it was time to convert.
Submitted by Dale on March 25, 2009 - 3:50pm
The LinksDB module provides a nice "it just works" way for implementing a classic Links or Resources page. The standout feature is its hierarchical display of the URLs. Even after Views and CCK arrived, the hierarchical display was worth staying with the module. Sadly, with a site to upgrade and no Drupal 6 version of LinksDB in sight, it was time to convert.