Converting block templates and page variables
Video: Converting block templates and page variablesAs we continue the process of migrating from Drupal 6 to Drupal 7, we're beginning to take a look at block templates. However, for this particular design, the only thing that's really changing is the heading on the blocks from h2 to h3 to h4. So we'll go ahead and take a look at exactly what we need to do, what the process of migration for this particular section is very simple. If we take a look at the Hansel & Petal Drupal 6 version and then open up Firebug and take a look at the left- hand side blocks, we can see that for this particular block for admin, it hasn't heading of h4.
Viewers: in countries Watching now:
Drupal 7: Creating and Editing Custom Themes shows the tools and techniques needed to build custom web sites with Drupal. Author Chaz Chumley introduces Drupal theme administration and takes a look at basic theming concepts, such as templates, regions, and variables. The course explores how Drupal default themes are configured and structured and how to install and edit a theme. The course also explores the tools a designer needs to create a Drupal 7 theme, using HTML, CSS, PHP, and Drupal templates, or migrate an existing Drupal 6 theme to Drupal 7. Exercise files are included with this course.
- Installing Drupal 7 on Mac or Windows
- Using the Devel and Theme Developer modules
- Understanding templates and variables
- Choosing global and theme specific settings
- Creating a theme roadmap
- Creating the theme folder, structure, and .info file
- Customizing HTML templates and variables
- Creating template regions and rendering page variables
- Understanding performance considerations such as caching
- Migrating themes from Drupal 6 to Drupal 7
Converting block templates and page variables
As we continue the process of migrating from Drupal 6 to Drupal 7, we're beginning to take a look at block templates. However, for this particular design, the only thing that's really changing is the heading on the blocks from h2 to h3 to h4. So we'll go ahead and take a look at exactly what we need to do, what the process of migration for this particular section is very simple. If we take a look at the Hansel & Petal Drupal 6 version and then open up Firebug and take a look at the left- hand side blocks, we can see that for this particular block for admin, it hasn't heading of h4.
If I introspect the recent blocks post, I see a heading of h2. And then if I take a look finally at the blocks on the right-hand side, I see that they have a heading of h3, and this is all based off of how the block templates are working. So let's actually browse over to our editor and take a look. The first thing I am actually going to do is grab a hold of the modules>block>block.tpl. I am going to copy it and I am going to paste it into our sites>all>themes> hanselandpetal>templates folder.
Right-click, paste and then go ahead and open it. If I scroll down and take a look, we see that currently, the default is an h2 heading for any of the titles. So as far as actually doing a migration of this point, we are perfect for what we actually have and there is no real change that needs to take place. But for the right-hand sidebar, if I want to make sure that all the blocks that are part of that region have a different heading, I can simply make a copy of this block and rename it based off the template suggestions to block--sidebar_second.tpl. php. Let's do that now.
I am going to copy and paste the same template back in and then give it the new name based off that template suggestion. So block--sidebar_second.tpl.php. I am going to go ahead and click OK and then open up that block, scroll down, and change the h2 to be an h4.
Go ahead and save that template, browse back over to our Drupal 7 instance, close Firebug for a second and then click on the Performance tab and clear all the cache. Close the performance interface and we're not going to see any real change unless we actually take a look at it through Firebug. So let's open up Firebug and inspect the Search element. We can see that the title on here is a title of h4 and if we scroll down and take a look at the syndicate block, we should also see an h4 and we do.
Go ahead and close Firebug, scroll back up to the top and now if we start to do a comparison once again between our Hansel & Petal 7 site and our Hansel & Petal 6 site, we should start to see similarities between these. The only thing that we really have left is to clean up some of the CSS to make sure that these themes completely match 100%. So while the only thing that we currently change was headings for the title, the process of converting block templates is not very complicated. Let's move on to tackling the remaining miscellaneous template conversions and CSS cleanup in Drupal 7.
Find answers to the most frequently asked questions about Drupal 7: Creating and Editing Custom Themes .
Here are the FAQs that matched your search "" :
- Q: The Acquia Dev Desktop Control Panel won't open after I restart my system. Is this a bug? What can I do to fix it?
- A: Some Mac users are having semi-serious difficulties with the Acquia Dev Desktop Control Panel repeatedly failing to open after routine system restart. See here and here for details.Fortunately, a reasonable work-around for an otherwise crippling issue is running this shell command in Terminal:Panel.app/Contents/MacOS/AcquiaDevDesktopControlPanelAcquia Dev Desktop Control Panel is not the only solution available. As an alternative, Mac users can switch to MAMP and Windows users can switch to WAMP, until this issue is resolved permanently.
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.