Overlapping the main page in Drupal with your own. Overlapping the main page in Drupal to your Drupal how to create an article on another page

(Drupal) is a popular open source content management system source code... Because of its powerful functionality, developing complex websites in Drupal is much easier than writing them from scratch. Not surprisingly, thanks to its large user community and the sheer number of modules, we hear more and more about Drupal.
In this tutorial, we will put our hands on Drupal and create a site with a new content type and pages for displaying it.
Ready? We immerse ourselves in exclusively powerful system content management!

Tasks
After reading of this manual you:
  • learn about the advantages and disadvantages of Drupal;
  • install Drupal;
  • understand how it works;
  • learn about Drupal modules;
  • learn to work with administration pages;
  • create and publish site content;
  • customize your content type with CCK;
  • learn to create views to display content using a module Views;
  • create paginated views;
  • create block-mapped views;
  • learn about themes.
What will we do
We will develop a website on Drupal with a job board where visitors can post jobs and projects. Our goal is precisely for you to start building sites right away, and not just read how it is done.
Why Drupal?
First, let's take a quick look at the advantages (and disadvantages) of Drupal so that you can decide if this CMS is right for you.
Dignity
Open source. Yes, Drupal is open source, which means all the benefits of open source are available to you.

Flexibility in configuration. Drupal's main strength lies in its flexible architecture. You can use it to build any type of website, from social media sites that allow users to post and vote on their own content, forums and job sites, to galleries or designer portfolios. Drupal will do an excellent job of the task (of course, for this you will have to work a little).

A large and literate developer community. Drupal has a large, vibrant and open community of users and developers. This means you have great modules, timely bug fixes and kernel updates, and an endless stream of documentation and tutorials online.

Modules. For Drupal, a huge number of modules have been developed that extend its original functionality (we will talk about what a module is a little later).

Ease for developers. As a web developer, you will not feel constrained when working with Drupal. After all, Drupal was designed with the needs of the developers in mind. A mistake in some major CMS is to over-emphasize user interface, which often entails a lack of attention to the needs of those who, in fact, will develop and promote the system in the future. But this is not the case with Drupal.

Built-in caching system. Drupal has a built-in caching system that can reduce server load and speed up page generation. Caching avoids complex database queries, which improves server performance.

Decent built-in search engine. Unlike other CMS, Drupal has a very good search engine implemented at the core level. Of course, it cannot compete with search services such as Google search, or Yahoo! Search BOSS, but nevertheless quite suitable for work.

disadvantages
Long learning process. Yes, it is a fact that learning Drupal is somewhat more difficult than learning other CMS. I would not recommend Drupal if you want to make your first website after a week of dating. It will take you months to truly understand Drupal, and as many more to build your first full-fledged website. However, it should be noted that a small site you can create in less than a day(which is what we are going to do in this guide).
Difficulty for non-developers. Since the needs of developers are at the forefront here, for those who are not very familiar with information technology, it will take some time to get used to Drupal. This means that it will be difficult for specialists with only a superficial understanding of web development to create (or even administer) sites on Drupal.
Complex interface. The site administration interface in Drupal is somewhat difficult to understand; overall it is not as user-friendly as it could be. (This will change soon, though.)
Drupal vs WordPress
Wherever Drupal is discussed, there is always an irresistible urge to compare it to another leading open web platform; usually it is WordPress.
And no matter where you assume that WordPress is not a full-featured CMS, but just a blogging platform, there will always be a heated discussion awaiting you. I myself use both CMS, but sometimes WordPress features just aren't enough.

In other words, if you are making a serious resource with registration, authentication, set of permissions and roles, for example, an Internet shop, forum or website with video and audio materials that users add themselves, it makes sense to use a more serious CMS than WordPress.
I would not recommend you use Drupal if your client only wants a blog or a simple portfolio site with a few pages and basic content: these sites are faster and easier to build on WordPress. Drupal is clearly redundant for this.
Another important argument against using Drupal is the interface, which is not easy for inexperienced users to understand. This is a compelling argument for WordPress.

Drupal powered sites
To inspire you, I will list a few sites on Drupal.

Mozilla, the company responsible for Firefox, uses Drupal in almost all of its web projects. The official Mozilla and Spread Firefox sites are made in Drupal.
Download and install Drupal
For the purposes of this tutorial, we will use the latest stable release. Drupala 6; download it from here.

Installing Drupal on XAMPP
Here we will install Drupal on our computer, but if you want to install it on a real server, the process will be similar.
To install Drupal on your local machine, you need a server platform such as XAMPP or WAMP... Don't be alarmed if you've never heard of them - they are very easy to use.
If you don't have a local web server yet, install XAMPP now.
Below is a link to a simple guide by Jacob Gyub (founder and editor-in-chief Six revisions), which you will very quickly install and configure XAMPP (the manual is written for WordPress, so only follow the first part of it, steps 1-26, keeping in mind that you are not installing WordPress, but Drupal):

For the rest of this tutorial, we will assume that you are using XAMPP, so if you choose a different server package, you may need to slightly change the installation process.
Copy Drupal files to XAMPP directory

Copy the Drupal package you downloaded earlier to the xampp \ htdocs directory. Unpack the files and rename the folder to "drupal" for ease of navigation.
Now go to xampp \ htdocs \ drupal \ sites \ default folder.

Create settings.php
Make a copy of the default.settings.php file and rename it to settings.php.
Make sure that you didn't remove default.settings.php otherwise, Drupal installation will fail with an error; this is one of the most common mistakes by novice developers on Drupal.

We create a base MySQL data
Drupal uses data storage MySQL... So we need to set up the MySQL database in advance. To do this, we will use - a web interface for convenient administration of MySQL databases (it is already included in the XAMPP distribution).
Go to the page in the browser by the address:
localhost / phpmyadmin

V this example, I named the base db_drupal... You can provide superuser ( root) all privileges to work with the base db_drupal so that he can read, write and modify the data in the database. However, to use a root account on a production site - not the best practice... It is best to create a separate user for this database and grant only the necessary privileges to it. Now we will do so.

Creating a separate MySQL user for the Drupal database
In our example, I will create a new MySQL account and name it drupal_user... For production sites, however, it's a good idea to use a non-obvious, random username to reduce the likelihood of a brute-force attack.
And for sure do not use root account, since most hackers will "try" it first. The root user in MySQL has super privileges and has access not only to your drupal_db database, but also to other databases. (By the way, a good option is to delete the root user altogether and not use it anywhere. You can create a pseudo-root user, but more on that some other time).
To create a new MySQL user go to the phpMyAdmin home page and then click on the tab "Privilege".
Now press "Add new user" and fill in the input fields with the required data.


While you are working on your local machine (that is, Drupal is installed on your computer and running on XAMPP), you can select all available privileges, but on the production server it is highly recommended to install only those that really necessary drupal_user.
For our example, I selected only those privileges that I want to grant to the drupal_user.

  • Select
  • Insert
  • Update
  • Delete
  • Create
  • Alter
  • Index
  • Create Temporary Tables
  • Lock tables


This concludes our work with MySQL and phpMyAdmin.
Drupal localization (from translators)
In order for the installation process to coincide with the illustrations in this manual, you must install the Russian version of Drupal. To do this, you need to download its translation. Translations of Drupal and its modules into Russian are available on the Drupaler.ru website. To download the translation of Drupal itself, go to this page, fill out the form as shown in the picture and click "Export".

Then unpack the downloaded archive into the same directory where Drupal was unpacked a little earlier.
Translations of additional Drupal modules are also available at Drupaler.ru. Since we will need the CCK and Views modules later in the tutorial, download their translations now from the CCK Translation and Views Translation pages.

Installing Drupal using the installation wizard
So, let's enter the following URL in the address bar of our browser:
localhost / drupal
If you remember to rename the unpacked Drupal directory to "drupal", everything should work. If you forgot, replace “drupal” in the URL with the folder name that you specified when unpacking Drupal files into htdocs.
As soon as you go to the URL above, you will immediately see the Drupal installation menu. You can select your preferred Drupal interface language on the first page. Please note that this option can be changed later from the admin area. We will continue with the installation in Russian, so let's select "Install Drupal in Russian".
On the next screen, Drupal will check if your server (in our case, the local machine) is capable of working with Drupal. If your server does not have enough applications for Drupal, an error message will be displayed.
Next, you will see the screen database configuration... Here you need to provide the same information that you used when creating the drupal_db table and drupal_user user.


In the same place, on the database setup screen, click on " Additional settings "And you will see an option called" Table prefix", Which allows you to add a given string to the name of all MySQL tables in Drupal (eg. blackjack _drupal_table). I recommend that you give a random prefix that only you can understand; this caution will help mitigate the threat of a SQL injection attack against the database.


If all the previous steps were performed correctly, Drupal will start installing the necessary modules, after which you will be redirected to the page configuring the site.


The configuration options are intuitive, so I'll let you enter all the necessary information yourself.

Setting up clean links
One of the options that may be unfamiliar to you is called “ Clean links"And is located in the" Server settings "section. The links generated by Drupal by default are non-intuitive and look something like localhost / index.php? Q = 21.
When clean links are included, URLs look nicer, easier to remember, and improve SEO. For example localhost / events.
For clean links to work, mod_rewrite (the Apache module) must be installed on the server. Most likely, you already have it installed.
If mod_rewrite is not installed or running (which is unlikely if you have an Apache server), Drupal will give an error and clean links will not be available. This will not prevent us from building the site, but for the reasons described above, clean links should be included as soon as possible.

If you followed the tutorial correctly, you will see a screen like this:

Don't worry if an error appears. mail functions(): it occurs due to the fact that we are using XAMPP on the local machine and simply did not configure mail server therefore Drupal will not be able to send emails to administrators.
When you work with a real server, these things will already be preconfigured (unless you are making your own web server that has not already been configured).

Go to the Drupal admin panel
Let's go to Drupal admin area. As soon as you visit the new site at localhost / drupal, the following page will appear:


Go to the admin panel by clicking on the "Management" link.
Now that you've installed Drupal, it's time to discuss the concept of modules.
What are Drupal modules?

Modules are Drupal extensions that add additional functionality to it.
For example, Drupal comes with a preinstalled module called "System". In fact, Drupal is a collection of kernel modules that are developed and maintained by the project team. The System module is one of them, Drupal cannot work without it.

How to add Drupal modules
In addition to the kernel modules that are part of Drupal, you can download additional modules from the official repository. In addition, after gaining development skills on the Drupal modules API, you can create your own modules.
After you find required module, download it to your computer.
Then you need to transfer the unpacked module to the drupal \ sites \ all \ modules directory.
Default there is no folder for modules so you need to create it manually. Create a modules folder in drupal \ sites \ all.
It is good practice to keep downloaded modules separate from the default ones in the Drupal distribution, so do not put additional modules in drupal \ modules.

Installing an add-on module: CCK module
CCK (Content Construction Kit) is a very popular Drupal module that allows you to create various new types of content. Let's practice installing modules using CCK as an example, especially since we will need it in the future.
First, download the appropriate CCK version. Then unpack the archive into drupal \ sites \ all \ modules; in the same folder, unpack the archive downloaded earlier from Drupaler.ru with the translation of the CCK module.
After downloading and placing the CCK module in drupal \ sites \ all \ modules, you need to enable it in the Drupal administration interface. Go to the menu Site construction> Modules(localhost / drupal / admin / build / modules). Here you will see the CCK * module. Turn it on. You can also enable CCK submodules if you need them (later, when we start working with CCK, we will do so).

* - according to the tradition established in time immemorial, the module, called CCK everywhere and everywhere, is called Content in the list of modules.
Congratulations! You have just installed the Drupal module.

Drupal Admin Pages Crash Course
There are two options for viewing the administrative sections of Drupal:
  1. By tasks.
  2. By modules.
If you choose to display " By tasks”, The page will be organized by different administration tasks.
For example, if you organize the By Tasks page under the Contents heading, you will see all tasks related to working with the content. "Content", for example, allows you to view, edit and delete content, and "Publishing Settings" control their behavior and display on the site.
Each task under the name has short description to help you understand its purpose.
If you choose to display " By modules”, Then the links will be organized by module.
For example, in the "By Modules" display under the "System" module heading, you will find the items "Setting Permissions", "Clean Links", "Modules" and so on.
Learning curve of the admin interface
Get used to the Drupal administrative interface can be very long; however, there are many additional modules that make it much easier to work with the admin panel.
I advise you to install the Administration menu module, which adds a drop-down navigation menu to the top of all pages on the site, visible only to the administrator.

Setting up the home page
Time to act. Let's create a home page. To do this, we will add the first "Page" type material to the site. Let's go to the menu Content> Create Stuff> Page(localhost / drupal / node / add / page).

The default theme Drupal uses displays a navigation menu in the upper right corner. The settings in the "Menu Options" section determine whether to include a link to our page in the navigation or not.
If you want to add a homepage link to the main navigation menu, select Main Links from the Parent Item drop-down menu.
Option " The weight»Allows you to organize the order of displaying links. Links with lower weight will be displayed first because they are "lighter".
So, for example, if the link "Home" has a weight of 0, and the link "About" - 5, then the item "Home" will be shown first, because it is lighter.
If the Home link has a weight of 0 and the About link has a weight of 0, then Drupal will organize the links in alphabetical order. Since the weight is the same, the "Home" item will be displayed first.
In our case, we leave the weight of the "Main page" unchanged (by default, the weight is zero).

The selector in the "Input Format" section allows you to select the method for entering content.
Format Filtered HTML limits the set of HTML tags that can be used in the text by filtering out dangerous HTML elements like