1. Installing Drupal 7
2. The basic concepts of Drupal
3. Installing themes ZEN
4. Install and configure the sub-theme
5. Adding of your own blocks in the theme
6. Creating of content type
7. The theming of content type
Installing Drupal 7
The first step, that you should do is to download the latest Drupal 7 from the official website. At the moment the latest version of Drupal 7.43 www.drupal.org/drupal-7.43-release-notes .
After downloading unzip the archive to a folder with your future website. For example, site one; so, that through this route will be available the file /home/admin/www/site_one/index.php .
After than Drupal was downloaded to the working folder, click on the url of your website in the browser. For example, site one .
Install the standard installation profile and the English language by default.
Next you need to determine the database type and set the path and configuration database. But first you need to create the database itself. In our case, we use MySQL. To create a database we can use terminal.
First, go to the MySQL shell:
enter the password for the user root and create a new database with the command:
CREATE DATABASE database name;
where, name - is the name of your new database. By the way, to see a list of all available databases, you can use the command SHOW DATABASES.
Next on the configuration page, append the database name, user, password and host.
After saving the data about the database will be establish of the main modules of the system and the next step will be configure of your established site,
as well as setting of the time zone and automatic updates.
The basic concepts of Drupal
In Drupal there are several basic terms, which must to operate each Drupal Developer:
- Entity - the main component of Drupal, which contains information about a specific data type and allows you to organize the construction of the site.
- Taxonomy - if you look at the counterparts of other content management systems, this is a more advanced system of assigning tags or categories, allowing you to categorize and link by subject content, but, unlike analogs, the taxonomy has a much greater capacity. Taxonomy is a kind of Entiti, that comes with Drupal in a box.
- Node - a kind of Entiti, which is responsible for maintaining a specific site. In gcd, we can include the articles, basic pages, news, and more. Noda is available on your website at address /node/[node_id] .
- Content types - for the distinguish node to destination, they can be divided into so-called types of materials. Each type of materials can have its own set of fields and properties.
- Views - is a module of Drupal, which allows you to show different nodes, taxonomy or other Entiti in a list format (and other formats) with filters, sorting and many extra features.
- Themes - set of styles, scripts and templates of site, that allows you to change the appearance of the site.
- Modules - set of files that extend the functionality of the site. You can download modules from the website drupal.org or write your own module.
- Blocks - part of the site appearance, that you can place anywhere on the website and to fill any content. You can create a block programmatically and through the admin panel of Drupal here admin/structure/block .
- Cache - is a set of data that is generated once and then used many times to speed up the performance of your site. In Drupal, the cache can be reset by going to admin/config/development/performance and clicking Clear All Caches .
- Template - file (usually with extension tpl.php), which serves to output variables Drupal to html template.
- Page - is a structural unit of any website, which contains all other structural units and is considered to be the parent.
- Region - is a part of the site where the blocks are placed.
If schematically depict some elements of the site created on Drupal, it turns out this collage.
Installing themes ZEN
There are a lot of themes for Drupal. In most cases, you can simply download your desired theme and adjust it to fit your requirements. However, sometimes you need to write your own themes.
Today we will install ready-made theme ZEN. You can download it here www.drupal.org/project/zen .
What does it mean to install a new theme? This means that you need:
- Download the theme files;
- Upload the theme files in the folder /sites/all/themes, so that the file [theme_name].info will be available in the path /sites/all/themes/[theme_name]/[theme_name].info
- At address: /admin/appearance to enable the new theme.
Install and configure the sub-theme ZEN
In some cases, it is very convenient to install a sub-theme. Sub-theme has all the features of a parent theme and allows you to extend its functionality without changing the core parent theme. Usually sub-themes are in the assembly with the parent theme. In our case, sites/all/themes/zen/STARTERKIT
- Copy the folder sites/all/themes/zen/STARTERKIT in sites/all/themes and rename it to make sites/all/themes/foo, where foo - is the name of your new sub-theme;
- In your new theme folder rename the file STARTERKIT.info.txt in [subtheme_name].info . for example, from foo/STARTERKIT.info is to foo/foo.info . Also rename a title in the middle of the file and description of your new sub-theme;
- Next you need to edit files template.php and theme-settings.php. In each of these files the word STARTERKIT you must to replace to the name of your theme;
- The last step is clearing the cache of Drupal and the inclusion of the new sub-theme admin/appearance.
The Drupal cache can be cleaned here /admin/config/development/performance .
For more information on how to install the sub-theme you can found in the folder with them \sites\all\themes\zen\STARTERKIT\ in the file readme.txt .
Adding your own blocks in the theme
Blocks are added via the admin area of the site /admin/structure/block/add .
To add a block, enter the block name (not required) short description of the unit and its contents.
The important point of the block creating is setting of its position in the site. In other words, you need to choose the region in which site will be located a block for our theme.
When the region is set (by the way, doing so is not necessary if you just want to create an invisible block), you can set the visibility of the block. Suppose you need to display a block on one page and display it on all other pages. For this there are a number of settings Visibility settings.
Here you can specify the visibility at pages, content type, user role, and allow users to change the position of the block.
By the way, the whole list of blocks present on your site can be viewed here /admin/structure/block .
Creating a content type
Creating content types - is one of the most important stages in designing the website. Created a content type, You can create the materials based on it and publish on your site. Then you can create Viewcs and sort or filter your content as you like.
All of the available content types are at the page /admin/structure/types .
Create a new content Type by clicking on the link Add Content Type (/admin/structure/types/add):
- Set the name for our content type;
- Write a short description of why we are creating this content type (optional);
- Custom base options which affect the way of displaying our new entity.
After saving, we get a new content type that has basic features and a set of fields. The set of fields can be changed, we can always add new fields.
For example, add new field of type Image. This will allow us to keep pictures in the new material.
When saving the new field you will need to confirm some basic settings. The basic settings for each field type are different, so in order to explore them all, we must try to create fields with different tiema and widgets.
As a result, you will be able to create new content, which will have the properties of Your data type.
To create content, you need to go to the page Add content and click on new content type.
As a result, you should obtain this kind of forms of material addition.
Filling out the form, we will get a full page that you will be able to see your website visitors.
The theming of content type
The theming of content type is a change of the default view of your content programmatically. To theme the content type - is to create the topic (or module) template (file) that will be responsible for the changed structure of the material.
Let's make theming for our new content type. For example, what is called a new content type test. Create in the folder /templates of our theme a file called node--test.tpl.php and copy in it the contents of the file node.tpl.php . Then make the necessary changes in a new file and cleared the Drupal cache.
That's all, the theming the node of our new content type is done. Now we can convert any type of content our personal file and change its structure, whatever.