Drupal is a great tool for working on the web, but to give it some context, in this lesson we're going to take a quick step back in time, and understand the history of working on the web and look at how the tools that Drupal provides match up with problems encountered over the years of web development.
Additional resources
In this lesson we're going to break down the "Drupal stack" to understand what pieces are working here and how they relate to each other. We'll take a tour of the major components of Drupal itself, like nodes and users, and then have a brief discussion about ways of organizing content.
Additional resources
Deploying Your Code
FreeIn this lesson we will take the code we have committed to our remote repository and manually push it to our production server. We will cover how to setup deployments on beanstalkapp.com and the some of the advantages of using a tool like this.
A question we are commonly asked is: how did your production environment recognize the new feature?
Answer: Reverting a feature reverts it back to what is in code. So by updating the code it always looks to the code so there is no need to revert it. You usually revert a feature if you have made changes that are stored in the database and you need it to look back to the code as your database changes are not what you wanted or are wrong. If the changes you made in the database are what you want, then you update/recreate the feature.
One thing we haven't looked at in our feature yet is Drupal roles and permissions. Here we will create a role associated with out Blog feature and look at how we can roll that important bit in.
In this video we are using the Environment Indicator module to visually distinguish between different environments.
Additional resources
Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)
Features will auto-detect dependencies for you, which can be very handy, but at times it can also be very frustrating when you don't want them to. In this video we introduce the Features Plumber module and show you how to use it to finely control your dependencies.
We are sometimes asked how Features can be removed. Since a Feature is just a normal module, you can disable it on your module administration page, and even uninstall and completely remove it from your modules folder. That will completely remove the feature from your site.
Note: The Features plumber module is no longer necessary if you're using Features with Drupal 7. The functionality provided by this module has been included into newer versions of the Features module. So as long as your Features module is up-to-date you should be good to go. The concepts from this video do still apply.
Additional resources
Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)
This video describes a number of the most important configuration files within MAMP that are commonly edited in order to run a web application like Drupal locally. There's a brief tour of the http.conf file, and then walks through the process of upping the max_allowed_packet limit from 1M to 2M within the my.cnf, which was a renamed copy of the my-large.cnf file. It's also a good idea to turn off binary logging on your local development by commenting out log-bin and binlog_format lines within this my.cnf file. Addi then shows you how to raise the PHP memory unit from 32M to 256 by opening the php.ini file and changing the memory_limit value. Finally, she shows you how to use MAMP's version of PHP and MySQL from the commandline by editing your .bash_profile and adding a number of paths to your default PATH. Note: The configuration files may have moved between versions of MAMP. You should check for where the MySQL cnf files are for your specific version of MAMP. A quick Google search can probably get you set in the right direction.
To learn how to install MAMP, see the Installing MAMP Server tutorial.
Additional resources
More information on Development Environments
This video walks through the process of downloading and doing the initial configuration of WampServer, which is Apache, MySQL and PHP for Windows. It shows how to turn it on and off, as well as how to get files to show up from the localhost server.
Next up: WampServer Configuration.
Notes:
If after installing WAMP you get a 404 error, make sure the server is actually running. Navigate to wampserver > apache > service > install service... opens prompt, hit enter... wampserver icon turns green.
Additional resources
More information on Development Environments
This video shows you how to download and do the initial setup of MAMP, which is Apache, MySQL and PHP for Macintosh. It shows some basic configuration tweaks to change the port from 8888 to the default of 80 so that you can just visit the localhost in the browser and get your Drupal installation to appear. It also provides a general orientation to MAMP, and some other initial configuration setting changes.
Next up: MAMP Server Configuration
Additional resources
More information on Development Environments
In this lesson, we will cover the basics of getting code into version control using the Mac app "Tower" and then making the first commit and pushing it to the remote repository we will setup on beanstalkapp.com.
Features is a module which generates modules for us. You can then extend that module just as you would any other Drupal module. In this video we'll add some additional code to our feature to make it more complete for our needs, outside of the realm of what Features itself can provide.
The features module (and the drush command) are pretty smart about not overwriting custom changes, and your chances of overwriting your custom code are pretty slim. When features exports a module it creates a .module file with only one line of code in it. Which is an include for another file: mymodule.features.inc. Features then puts all of the automatically generated code into this included file. When you regenerate or update a feature it just uses the existing mymodule.module file which maintains any code that you wrote, and then regenerates the mymodule.features.inc and associated files.
Additional resources
Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)
James Sansbury defines Features (a module that helps organize site components and applications for specific use cases), as distinct from Nodes and other forms of site content.
Prerequisites
This series assumes that you can install Drupal 7, create a basic content type, create a basic view, and use Drush. See the following resources if you need a refresher:
- Create a New Content Type
- Creating a New View
- Introduction to Drush series
- Installing Drupal with Drush
Additional resources
Features project (Drupal.org)
We'll create our very first feature and then see how it works by putting on our production site and enabling it.
Additional resources
Features project (Drupal.org)
Introduction to Drush Series (Drupalize.Me)
Hands-On: Generating Sample Content (Drupalize.Me)
https://github.com/DrupalizeMe/drupalize-lullablog (GitHub.com)
This video walks through some of the most common and important server configurations for running a local development server on WAMP. This will show you how to enable the Apache rewrite_module through the WampServer graphical user interface, and where the http.conf configuration file is located. It also walks through the process of creating aliased folders so that you can organize your files in your directory structure and still have it available in the localhost via your browser. The video also shows how to change the max_allowed_packet from 1M to 2M via the my.ini file, and how to up the memory limit from 128M to 256M via the php.ini file stored in the bin folder within the Apache version folder.
To learn how to install WampServer, see the Installing Wampserver tutorial.
Additional resources
More information on Development Environments
Before we set up a multisite we need to understand how Apache and Drupal work together to deliver the site we intend. In this lesson we'll look at the documentation for Drupal multisites, and then discuss the way you need to set up your Drupal directories. We'll also review the workflow that Apache and Drupal go through to get the correct site displaying in the browser.
Additional resources
Multi-site - Sharing the same code base (drupal.org)
In this lesson we'll be building a simple university site, udrupal.com, with different areas, each with their own website: the main site, a news site, and an alumni site. The news site is simply a subdomain of the main domain name, news.udrupal.com, and the alumni site actually has its own separate domain name, udrupalalumni.com. To get this done, you're going to learn how to confirm the DNS is working for the domain names. That is, that they are currently pointing to the right server. Then we're going to configure an Apache vhost on our server so that Apache knows where to find our Drupal code base. We'll finish things up by installing our main Drupal site, udrupal.com.
Additional resources
With our domains and Apache configuration in place, we need to make sure all three sites can be installed at the different domains by creating our multisite directories in the sites folder. In this tutorial, we'll create the necessary Drupal site directories and settings files for the three sites so they are all running smoothly, check the domains and install the other two sites, and wrap up by changing the theme on the alumni site.
Before we get started, you should make sure you have two empty databases created for the two new sites we'll be installing.
In this tutorial we're going to be working directly on a server using the command line. You can feel free to use a GUI interface for your site, like an SFTP app or just your local machine file browser and editor apps. If you want to brush up on using the command line, you can check out our free Command Line Basics series.
If we want to do development work on the university multisite, we need to do a few things to have this run smoothly in a local development environment with all of those URLs. The sites.php file is going to let us define aliases for the site configuration folders in /sites
. In this tutorial we'll explain why local development with multisite is tricky, and how to get it set up properly.
Additional resources
example.sites.php (api.drupal.org)
Drush is a really great tool for managing your Drupal site quickly and easily. If you don't already know about Drush, you should definitely check it out. When working with a multisite installation though, Drush can get confused if you don't give it all the information it needs. In this lesson we'll walk through how to use Drush properly with a multisite installation, covering both how to manage just an individual site and how to work with all of your sites at the same time.
One of the best ways to improve both the speed, and relevancy, of search results for a Drupal site is to stop using the Drupal core search module and start using Apache Solr. Solr is a Java-based application that provides an API for interacting with Apache Lucene via HTTP to facilitate the creation of excellent applications for performing full-text content searches, with a special focus on internet-based search applications. The quick pitch for why you should use Solr is it's insanely fast, especially when compared with Drupal's default Search module, and it can be scaled to handle millions of search queries per second and huge piles of data.
Since Solr is a third party application we need a way to bridge the gap between Solr and Drupal. Really, there are two parts to this puzzle: getting the data out of Drupal and into Solr so it can be processed and indexed, and passing a search query from Drupal to Solr in order to retrieve, and display, search results. For that, we'll use the Search API module, and the Search API Solr module.
In order to demonstrate a real-world use case we'll pretend that we're the owner of a website that contains a database of fish species. As the database has grown over time we've begun to feel the limits of Drupal's MySQL full-text search and want to improve our search tools. Using Solr will allow for better matches in full-text search, faster searches, and a lot of additional functionality like partial word matches, spell checking, facets, and more.
In this series we'll cover:
- What Apache Solr is and why you should consider using it
- Installing Solr and configuring it to work well with Drupal content
- The contributed Search API module
- The contributed Search API Solr module
- Configuring Drupal to send content to Solr for indexing
- Retrieving search results from Solr and displaying them in Drupal on both a stand-alone page and with the Views module
- Using Solr field boosting to influence result relevancy
- Using the contributed Facet API module with Solr to allow for faceted search results
- Configuring stop words, synonyms, and promoted search results in Solr
This series is for anyone that wants to improve the quality of the search functionality of their Drupal-powered site. There is some system administration required to install Solr, but it's pretty straightforward. Almost everything else is done via configuration in Drupal's, or Solr's, user interface and by editing simple XML configuration files. So, no PHP, or module development experience required. We do however assume that you're already familiar with basic Drupal administration.