Creating a flexible layout with blocks
Video: Creating a flexible layout with blocksOne way that you can change the look and function of your Drupal site without changing the theme is to use a feature called Blocks. Blocks let you put text or graphics, or even dynamic content at various points in the pages. For example in the left column, right column, top, or bottom. To use Blocks, first go to Administer and then Blocks. Here you have a list of various blocks, including those that are built into Drupal and are turned on by default. In this case, in the Left sidebar we see the User login and the Navigation Bar.
Viewers: in countries Watching now:
Drupal is a free, open-source content management system (CMS) for a variety of platforms. It has a robust user community and easy-to-use administration features. Drupal Essential Training covers all the important aspects of installing, configuring, customizing, and maintaining a Drupal-powered website. Instructor Tom Geller explores blogs, discussion forums, member profiles, and other features while demonstrating the steps required to make Drupal perform. He also teaches fundamental concepts and skills along the way, including installation, backups, and updates; security and permissions; flexible page layouts and CSS; menu navigation; and performance monitoring and disaster recovery. He also discusses how to select and install the community-supported modules that further expand Drupal's capabilities, and gives experienced PHP programmers tips on customizing page templates. Example files accompany the course.
- Understanding the inner workings of Drupal
- Creating stories, pages, blogs, forums, and polls
- Managing users and comments
- Setting and customizing themes
- Exchanging content via RSS
- Stopping comment spam with a CAPTCHA
- Launching a site and joining the Drupal community
Creating a flexible layout with blocks
One way that you can change the look and function of your Drupal site without changing the theme is to use a feature called Blocks. Blocks let you put text or graphics, or even dynamic content at various points in the pages. For example in the left column, right column, top, or bottom. To use Blocks, first go to Administer and then Blocks. Here you have a list of various blocks, including those that are built into Drupal and are turned on by default. In this case, in the Left sidebar we see the User login and the Navigation Bar.
The User login only shows up when somebody is logged out. So we'll log out here and see what that looks like, here is the User login and we are going to login again. Let's go back to Blocks now. As you go down, you see that the blocks are divided into various zones, the Left sidebar, Right sidebar, Content, Header, Footer. And as you look around the page, you see that these are graphically shown, Header up top, Left sidebar, Right sidebar, and so forth. At the bottom of the list of blocks are those that are not showing up on the page at all. You can move these into any of the above areas by either clicking on this arrow symbol and dragging it into the area. I am going to drag that back now or by grabbing this drop down menu and choosing the area where you want that block to appear.
Whenever you make a change, even if you drag it back to its original place there is a note that says that the changes will not be saved until you click on Save Blocks. The block layout on a page is specific to the theme, let's go to administer themes and see how that works, Administer and Themes. Right now we only have one theme enabled - the Garland theme. But let's say we also have Blue Marine available to us, we'll enable that and click on Save Configuration and then go back to Administer and Blocks. Now you'll notice we have a choice, Garland and Blue Marine up here. If we make a change in Garland, let's say we disable the Powered by Drupal badge that appears at the bottom of the screen, by dragging it down here.
Scroll to the bottom, click Save Blocks, and then we switch to Blue Marine. Aha! Powered by Drupal is still showing up in that footer. Let's go back to Garland and put it back. So remember, if you make a change in where blocks appear, you have to make that change to whatever theme is going to be active on your site. I am going to go down and just return this to the footer and click on Save Blocks. There are three types of blocks, which you can see in this list here. The first kind comes built-in automatically with Drupal. We already mentioned these - the User login block, Navigation block, the Powered by Drupal block, which you can see at the bottom of the page by default, is the one right down here.
A second kind of block appears only when it's installed by a module, let's go ahead and do that. We'll go back up to Administer and Modules and then turn on the blog Module. As always, we go down to the bottom of the page, click on Save configuration and then we'll go back to Administer and Blocks. As we scroll down, we'll notice a new entry in this list, Recent blog posts. If we drag that up to the right hand side bar, then whenever somebody on the site has added a blog post that will appear in the right hang column. We don't have to do that now, so we'll just leave it at none and save our blocks.
The third kind of block that appears in this list is that which you create explicitly by clicking on Add Block. I'll give you an example of this by going to my own website, savemyhomebook.com. Up in the left hand corner, we have a custom made block because I didn't like the way that it just showed, Admin and then there was a separate Logout link. I wanted to bring it all together into a one link. So I created this using some PHP code, so it says Logout Admin. This is a custom block out here, and we could actually go and take a look at the code to see how that works. By the way I got that code off of the drupal.org website, in the Code Snippet section, but let's go back to our site for now.
If we want to add such a block, we would click on Add Block. The block description we'll call Promotions, the blog title is also Promotions and in the block body we'll say, Buy two houses, get one free. Now let's continue on and take a look at all the options you have when you add a block. First of all, as when you add content you can choose the input format that you use. We'll just use filtered HTML, since Plain Text works just fine there. You also can choose what users will see this block and on what pages that block will be seen. You can choose specific roles that will see that block. So for example, it might be a block that helps people edit pages, but you only want people who are able to edit pages to see that block.
Well of course you could check or uncheck the roles that are appropriate. You can change whether or not users can choose whether to see that block or not. So for example, you could say they cannot control weather they see this block. That will always show the block, and they won't have any choice on it. If you say, show it by default but let them hide it or hide it by default and let them show it, then they can change that by going to their user page and change it in their profile with check boxes. Finally, you could decide on what pages you want that block to appear. For example, you might want a block to appear on every internal page but not on the homepage. In which case you would fill out the appropriate fields here and list the pages that you didn't want it to appear on here, including PHP code. We are going to have it show on every page, so we'll say Save Block. Now we look down our list of blocks and we see under disabled, we have our new block called Promotions. Whenever you create a new block, it always starts out as disabled that is, it's not automatically put on your page. We want that to be, let's say in the Right Hand column. So we'll do that and go back down to the bottom and click on Save; and there it is, it now shows up in the Right Hand Column.
Let's go back to homepage to see exactly how that looks. Tada! We now have our custom made block in the right hand column and nothing else on the page has changed. Blocks are one of Drupal's most powerful features, especially if you use them to show dynamic content such as the latest comment or blog post. Like many powerful features, however, it's easy to overuse them and make your site hard to navigate by throwing every block on to the page, but judicious use of blocks, can really improve ease at navigation and improve user engagement.
Find answers to the most frequently asked questions about Drupal 6 Essential Training .
Here are the FAQs that matched your search "" :
- Q: While following along to the installation instructions in the “Installing WAMP and Drupal on Windows” chapter in the Drupal Essential Training title, an error occurs when attempting to open the local host page. Nothing appears except for an error reading “WAMPSERVER server offline.” What is causing this?
- A: There is a known problem with some versions of WAMP that include a version of PHP (5.3) that some versions of Drupal is not compatible with. See http://tomgeller.com/content/tips-running-drupal-windows-using-wamp#comment-831 for more information.
If that is not causing the issue, reference the tips at http://tomgeller.com/content/tips-running-drupal-windows-using-wamp.
If you don't see the solution at either of those links, try using another AMP stack, such as XAMPP or the Acquia stack installer. See http://tomgeller.com/content/what-hells-wrong-drupal-wamp for discussion about these.
- Q: After installing XAMPP and running Drupal for the first time, the Administration menu does not appear. What is the reason for this?
- A: There are several possible problems. Here are some likely solutions. (These may also solve problems encountered with other AMP stacks.)
- Increase XAMPP's PHP allocation.
- Check to make sure all XAMPP's paths are correct and that permissions are correct. If the database information appears, but not Drupal's supporting files, and an included theme is being used, the supporting files will be in the /modules folder.
- Another solution is to not use WAMP or XAMPP. One option is to use Acquia's Drupal Stack Installer ("DAMP"), which can be found at http://www.acquia.com/downloads. However, that installs Acquia Drupal, which is a version of "normal" Drupal extended with additional modules. If only core Drupal is desired, see the instructions at http://acquia.com/blog/kieran/try-drupal-7-alpha-your-laptop-or-desktop. (The instructions are for Drupal 7, but will work for Drupal 6 as well.)
- Q: In the "Using the example files" movie, the method of importing information to the database is shown, using the backup in Chapter 10. When attempting to do this, the following error is shown: "No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16." The system is running the latest versions of Apache, PhP and MySQL, on Windows Vista. What could be causing the problem?
- A: This is probably caused because your AMP stack allocates too little memory to PHP.
That's especially true if you're using WAMP, which only gives PHP 2MB of memory, when it really needs at least 16MB.You'll see the issue if you go to the MySQL-controlling phpMyAdmin screen (probably at http://localhost/phpMyAdmin) and click "Import": The maximum file size allowed is 2,048K. That's only 2MB, and the databases for most Drupal sites are much larger than that. (The example site for Drupal Essential Training gets as big as 5MB.) The video "Installing WAMP and Drupal on Windows" shows (at around 3:30) where the php.ini file is, but here are some more-complete instructions to increase that memory limit.
- Click the WAMP icon in your system tray.
- Select "PHP". In the side menu, select "php.ini" to open a file containing PHP's configuration options.
- Search for the line, "upload_max_filesize = 2M".
- Change it to "upload_max_filesize = 32M" (or whatever you like).
- Save the file and restart WAMP. (Better yet, restart your computer entirely to be sure. I'm frankly not sure whether it makes a difference.)
- Now go back to that "Import" screen in phpMyAdmin: You should notice that the limit has changed.
- Q: I don't remember the default username and password used demonstrate Drupal.
- A: The default username used in the course is "admin"; the default password is "booth".
- Q: How can I change Drupal's administrative username and password?
- A: If for some reason the default exercise file username (admin) and password (booth) don't work, you can change them in the database itself using phpMyAdmin. (This technique is demonstrated in a video from Chapter 8, "Recovering from disasters".)
- Open your Drupal database with phpMyAdmin.
- Go to the "users" table. Click the Browse icon.
- For the row where uid = 1, click the Edit icon. (Note the value under the "Name" column: That's the administrator's username.)
- In the "pass" row, select "MD5" under the "Function" column
- In the same row, enter your new password under the "Value" column.
- At the bottom of the screen, click the "Go" button. You should now be able to log in with that username and new password.
- Q: In Windows Vista, the WAMP icon disappears from the system tray after a certain amount of time. How do I get it to reappear?
- A: To make the WAMP icon reappear (so that you can access localhost, phpmyadmin, php.ini, etc.), you have to activate the "start WAMP server" icon (from start menu, desktop or wherever). The system tray icon will reappear.
- Q: My .htaccess file disappeared. What caused this?
- A: A few times during the Drupal Essential Training video series, the instructor says to copy a Drupal installation by selecting all the files in the folder and then "dragging and dropping" them, either to a server or another location on your local computer. This is not the best way to do so, as the hidden file ".htaccess" will not be copied.
There are two ways to get around that problem:
Sorry for the error.
- When installing Drupal for the first time: Instead of copying files from the Drupal folder, move the entire folder to its target location and rename it. This is the easiest solution for those without experience with Unix.
- Use the command-line interface to copy the .htaccess file.
- Q: In the video, the instructor says the current version of Drupal is 6.3, but on the drupal.org site, the latest version is 6.17. Which is the newer version of Drupal?
- A: Drupal 6.17 is newer than version 6.3. For some reason, the the version numbers go 6.3, 6.4... 6.9, 6.10... 6.17. It’s counter-intuitive, but that’s the order.
- Q: My WAMP phpMyadmin will not allow me to upload the exercise files. It returns this message: "No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16." There was no previous database to drop, so what do I need to do to make this work?
- A: This is a common problem, caused not by Drupal, but by WAMP. WAMP only allows you to upload files of 2MB or smaller, which is much too small. The solution is detailed at http://tomgeller.com/cant-import-a-drupal-site-in-windows.
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.