Ways to customize the Drupal home page

Post time: 2014-11-05 17:19:22 Author: Anonymous I want to comment
This article mainly introduces the custom Drupal home page method, in the form of examples about several common implementation methods, very practical, need friends can refer to

This article illustrates how to customize the Drupal front page. Share with you for your reference. The specific implementation method is as follows:

Drupal's default home page looks like a list of blog posts. How do you customize it to look the way you want? There are several ways to do this:

Use Front Page module When most people realize a function, the first thing they think of is to use modules (Front Page home page module), but they do not agree with the use of modules at every turn, too many modules increase the system burden, the following method also solves the problem of customizing the home page without using modules.

Use page-front.tpl.php page template page-front.tpl.php is the page template of the home page, copy page.tpl.php and change the name to page-front.

Using node-front.tpl.php node templates If you only want to change the style of the nodes displayed on the home page, you can only change the template at the node level. Copy node.tpl.php and rename it node-front_page.tpl.php, changing the display style of the nodes in it.

Create a new page page using a page page as the home page, add the html code, and select full html, remembering the ID number. Navigate to admin/settings/site-information, in the bottom "Default front page" input box, now the default is node, we change it to node/1 (note 1 is changed to the ID number of the page set as the home page).

Use block blocks to define the display properties of blocks one by one in admin/build/block, fill in in the page visibility that needs to be displayed in the home page block (only displayed in the following pages), then this block is only visible in the home page. Modifying this block can customize the content of the home page, and you can add multiple blocks to display on the home page.

The biggest feature of the $mission variable is that it can only be displayed on the home page. Using this feature, we can easily customize the home page. Define the mission task in admin/settings/ site-information (put the home page code in it), then edit the page.tpl.php file and move $mission to the desired location. If this variable is not in the file, add the following code:

Copy code
The code is as follows:
<? php if ($mission): ? >
<div id="missions">
<? php print $mission; ? >
</div>
<? php endif; ? >

The above methods can be used alone or in combination as needed. Another option is to use the index.html static page directly, but this is out of drupal and therefore not recommended.

I hope this article will help you with your drupal site.

  • Tag: Drupal

Related article

Latest comments