Drupal Node

 All content on a Drupal website is stored and treated as "nodes". A node is any piece of individual content, such as a page, poll, article, forum topic, or a blog entry. Comments are not stored as nodes but are always connected to one. Treating all content as nodes allows the flexibility to create new types of content. It also allows you to painlessly apply new features or changes to all content of one type.

The ability to create different "content types" is a way Drupal allows you to have different kinds of nodes for different purposes. For example, an "article" is one content type, a "book page" is another, and a "blog entry" yet another. You can also create new content types of your own.

The Node module manages the creation, editing, deletion, settings, and display of the main site content. Content items managed by the Node module are typically displayed as pages on your site, and include a title, some meta-data (author, creation time, content type, etc.), and optional fields containing text or other data. 

Each node has an unique ID.

Attributes all nodes

Every node in a Drupal site no matter its type will have some common attributes. The following list is not complete, but it includes some of the more important node attributes:


Title: it is always required.

Node ID (nid): This is a numeric identifier that Drupal uses internally to differentiate between nodes. The first one will have Node ID 1 and this number will increment by 1 each time a new node is created. Once set this number is not changed. Deleting a node does not make its nid available for future use.

URL alias: Every node in a Drupal site can be accessed via its Node ID appending /node/[nid] to the domain of the site. Nevertheless, humans are better remembering phrases than numbers. Imagine that someone tells you to read the blog post at /node/491827. Wouldn't it be easier to remember something like /blog/intro-to-drupal-views? In my humble opinion, the latter is easier to remember. That is a URL alias: some text that you can set as an alternative to access a specific node. The URL alias is optional and even if set the node will continue to be available in its canonical /node/[nid] path. Using modules like Pathauto you can define rules for creating URL aliases so you do not have to write them manually each time.

Publication status: this is a 'yes' or 'no' (boolean) value that indicates whether a node is available to the general public or not. You might start creating a blog post, but need to review some resources before making it public. Instead of losing your progress, you can save the node as a draft (not published) making it available only to certain privileged users. Later you can revisit the node and, when it is ready, save it as published making it available to everyone.

Type: this is the content type the node belongs to. For example: basic page, article, car, event, etc.

Author and publication time: Who created the node and when (date and time) it was published. If content revisioning is enabled for the content type then Drupal keeps track of who performed  each modification and when it was made. Content revisioning will be explained in a later blog post.

Menu settings: whether this node should be included in a menu, for example, to appear in the main navigation of the website. Imagine a node containing general information about your organization having an "About Us" link in the main navigation.


No comments:

Write a program in PHP to reverse a number

A number can be written in reverse order. For example 12345 = 54321 <?php   $ num = 23456;   $ revnum = 0;   while ($ num > 1)   {   $...