Showing posts with label Drupal. Show all posts
Showing posts with label Drupal. Show all posts

Wednesday, August 28, 2013

Jump menu output style

The jump menu style will display each row of your view within a jump menu. This style requires that your view's row style is set to fields.
To properly configure a jump menu, you must select one field that will represent the path to utilize. In most cases, you will need to rewrite the output of this field. You should set that field to exclude from display. All other displayed fields will be part of the menu. Please note that all HTML will be stripped from this output as select boxes cannot show HTML.
Some examples of how this might be useful:

Jump to a node

  1. Create a new Node view
  2. Select the Node: Path and Node: Title fields
  3. Configure the Node: Path field to "exclude from display" and check "Use absolute link"
  4. Configure the Node: Title field by removing the "Label" and unchecking "Link this field to its node"
  5. Set the view style to jump menu
  6. In the style settings, set the "Path field" to Node: Path
Your view will now display with a select list and a Go button. If you select an item in the list and hit the Go button you will see the selected node's page in the browser.

Jump to a node's edit page

  1. Create a new Node view
  2. Select the Node: Nid and Node: Title fields
  3. Configure the Node: Nid field to "exclude from display" and check "Rewrite the output of this field"
  4. In the text field that appears for rewriting the output of this field, enter node/[nid]/edit
  5. Configure the Node: Title field by removing the "Label" and unchecking "Link this field to its node"
  6. Set the view style to jump menu
  7. In the style settings, set the "Path field" to Node: Nid
Your view will now display with a select list and a Go button. If you select an item in the list and hit the Go button you will see the selected node's edit page in the browser. Please note that users without rights to the node's edit page will see an access denied message.

Jump to a user profile

  1. Create a new User view
  2. Select the User: Uid and User: Name fields
  3. Configure the User: Uid field to "exclude from display" and check "Rewrite the output of this field"
  4. In the text field that appears for rewriting the output of this field, enter user/[uid]
  5. Configure the User: Name field by removing the "Label" and unchecking "Link this field to its user"
  6. Set the view style to jump menu
  7. In the style settings, set the "Path field" to User: Uid
Your view will now display with a select list and a Go button. If you select an item in the list and hit the Go button you will see the selected user's profile page in the browser.

Views Advanced settings

In the category Other you have different options to set Advanced configurations in your View.
Machine Name:
You can change the default machine name of the view.
Comment: No comment
You can Use the comment option to write comments for your Views, the comments are only shown in the Views UI. Comment your Display for other Maintainer
Use AJAX: No
If set, this view will use an AJAX mechanism for paging, table sorting and exposed filters. This prevents the entire page from refreshing. It is not recommended that you use this if this view is the main content of the page as it will prevent deep linking to specific pages, but it is very useful for side content.
Hide attachments in summary: No
Use aggregation: No
All fields that are selected for grouping will be collapsed to one record per distinct value. Other fields which are selected for aggregation will have the function run on them. For example, you can group nodes on title and count the number of nids in order to get a list of duplicate titles.
For more Information how aggregation work see the "Use Aggregation" Help Page
Query settings: Settings
Here can you set advanced Settings for the SQL Settings
  • Disable SQL rewriting
  • Distinct: No
  • This will make the view display only distinct items. If there are multiple identical items, each will be displayed only once. You can use this to try and remove duplicates from a view, though it does not always work. Note that this can slow queries down, so use it with caution.
  • Use Slave Server
  • Query Comment
Field Language: Current user's language
Caching: None
You can choose a "Time-based" Caching if you want. With it you get the option to choose the length of time raw query results should be cached and "The length of time rendered HTML output should be cached."
Link display: Page
CSS class: None
You can define some own CSS Classes for your View
Theme: Information
Clicking on the "Theme: Information" link provides you with a listing of all posiible theming files. The highlighted files are the ones Views is currently using. All other filenames are suggested templates.

Thursday, August 15, 2013

Views Basic settings

You choose the name of the current display.
This title will be displayed with the view, wherever titles are normally displayed; i.e, as the page title, block title, etc.
When you use have many items to display, you have the choice to display them in different variants.
Display a specified number of items
Specify the number of items to display per page and an offset. The offset is the number of items to skip. For example, if this field is 3, the first 3 items will be skipped and not displayed.
Display all items
All items will display, but you can choose an offset. The number of items to skip. For example, if this field is 3, the first 3 items will be skipped and not displayed.
Paged output, full pager
A Pager can be used to display items, with the possibility to select the next page and also the first and last page. When you have many items the query is very expensive. To avoid this, you can choose the mini pager.
You can also choose the number of items per page. If you enter 0, then there is no limit. Pagers also will respect an offset, if present. If multiple pagers are present on one page you may need to set this number to a higher value so as not to conflict within the ?page= array. Large values will add commas to your URLs, so avoid this if possible. Unless you're experiencing problems with pagers related to this view, you should leave this at 0. Enter the total number of pages to limit the number of values. When you leave the field empty all pages will show.
The Exposed options allow users to define their values in a exposed form when view is displayed.
You can choose "Expose items per page". With this option the user can determine how many items per page show in a view. Options for which label should display and what numberic options are also available.
Furthermore, you can choose "Expose Offset". When checked, users can determine how many items should be skipped at the beginning. You can define a label.
Paged output, mini pager
The pager optiona are the same as for the "Paged output, full pager" but you have no possibility to jump to the last or first items.
Normally, all views are created with unrestricted access. This means any site visitor can see the views. Please consider this when you make a view with a menu link and private data as output. You have by default two options: "Permission" and "Role". If you choose permission, you get a list of all permissions. Only users with the selected permission flag will be able to access this display. If you choose role, you get all roles as checkboxes. Only the checked roles will be able to access this display. Note that users with "access all views" can see any view, regardless of role.

View settings

With the Description and Tag you can set the "View description" and the "View tag". The tag help you to organize your views. Only one tag may be entered for a given view. Note that this tag can also be used in themeing, so do not use words already reserved by Drupal for use, such as "Page".
You can clone a view. When you click on the clone link on the upper right, all the options in the current view will copy to a new view, which can be given a new name and edited further.
You can export a view. You can the copy and paste the code from a view into a module or something else. It is a array with all options for that view.

Views Performance

Views module is optimized for certain practices. To ensure Views has its best performance, please follow these best practices for Views.

Views Multiple Views vs Multiple Displays

Multiple displays in one view is appropriate when they are fundamentally similar and are sharing quite a fair amount of data. For example, showing upcoming events in either blocks or page and sorting it according to either event name or date of the event will be appropriate to be implemented by four displays (two blocks and two pages) in one view.
In the other hand, having multiple displays in one view that contains mostly overrides will be a burden to the system and will be hard to maintain. The effect of having only couple of such displays has negligible performance difference. It will be magnified when the number of displays in one view is large.
Another consideration is the use of Views, especially when using multiple views in conjunction with other modules such as Panels. It is entirely possible to have many views on a page due to Panels' ability to contain a view in each pane. Some people have mistaken this as a problem on Panels' or Views' part, but realistically it is likely to be the sheer number of queries that are being run during page render.

Known Issues and Workarounds

Image Assist & ImageField Assist

Under certain conditions these modules can block access to the header input section of the admin.
They need to be disabled on certain views paths. To do this go to
Image assist ->Access settings
check "NOT on specific paths":
and enter
For Drupal 6.x:
admin/build/views/ajax/display/*
admin/build/views/ajax/*
For futher reference please see this issue for more information
Drupal 7.x has different paths

What are views overrides?

If an item is using defaults then it is using values from the default displayIMPORTANT NOTE: If you modify this value, you are modifying the default display and thus modifying for all displays that are using default values.
If that is not what you intend, you must click the override button. Once overridden, that display now has its own version of the value; modifying it will not modify it for other displays. You can override in the settings of the non-default display when you are clicking on the header of the section or on the rearrange button.
For relationships, arguments, fields, sort criterias, and filters, each of these must be overridden as a group! In other words, you cannot override a single filter, but instead must override all filters. A message will appear on the item to let you know what its status is, but you can only change the status by clicking on the header or the rearrange button for that item

Views Feed Display

A feed display allows you to attach an RSS feed to a view.

Monday, August 12, 2013

51. Explain Drupal User, Permission, Role in Drupal

Every visitor to your drupal site, whether they have an account and log in or visit the site anonymously, is considered a user to Drupal. Each drupal user has a numeric user ID, and non-anonymous users also have a user name and an email address. Other information can also be associated with drupal users by modules; for instance, if you use the core Profile Drupal module, you can define user profile fields to be associated with each drupal user.
Anonymous drupal users have a user ID of zero (0). The drupal user with user ID one (1), which is the user account you create when you install Drupal, is special: that user has permission to do absolutely everything on the site.
Other users on your site can be assigned permissions via roles. To do this, you first need to create a role, which you might call "Content editor" or "Member". Next, you will assign permissions to that role, to tell Drupal what that role can and can't do on the site. Finally, you will grant certain users on your site your new role, which will mean that when those users are logged in, Drupal will let them do the actions you gave that role permission to do.
You can also assign permissions for the special built-in roles of "anonymous user" (a user who is not logged in) and "authenticated user" (a user who is logged in, with no special role assignments). Drupal permissions are quite flexible -- you are allowed to assign permission for any task to any role, depending on the needs of your site.

50. Which are the files in a typical drupal theme and their purpose

A drupal theme is a collection of files that define the presentation layer. You can also create one or more "sub-themes" or variations on a drupal theme. Only the .info file is required, but most themes and sub-themes will use other files as well. The following diagram illustrates the files that are found in a typical drupal theme and sub-theme.

DRUPAL 6


DRUPAL 7

theming requirements
.info (required)
All that is required for Drupal to see your theme is a ".info" file. Should the theme require them, meta data,style sheetsJavaScriptsblock regions and more can be defined here. Everything else is optional in drupal theme.
The internal name of the theme is also derived from this file. For example, if it is named "drop.info", then Drupal will see the name of the theme as "drop". Drupal 5 and below used the name of the enclosing folder of the theme.
Info files for themes are new in Drupal 6. In version 5, .info files were used solely for drupal modules.
template files (.tpl.php)
These drupal templates are used for the (x)HTML markup and PHP variables. In some situations they may output other types of data --xml rss for example. Each .tpl.php file handles the output of a specific themable chunk of data, and in some situations it can handle multiple .tpl.php files through suggestions. They are optional, and if none exists in your drupal theme it will fall back to the default output. Refrain from having complex logic in these files. In most cases, it should be straight (x)HTML tags and PHP variables. A handful of these templates exist in directories where core and contributed modules exist. Copying them to your drupal theme folder will force Drupal to read your version.
Note: The theme registry caches information about the available theming data. You must reset it when addingor removing template files or theme functions from your theme.
template.php
For all the conditional logic and data processing of the output, there is the template.php file. It is not required, but to keep the .tpl.php files tidy it can be used to hold preprocessors for generating variables before they are merged with the markup inside .tpl.php files. Custom functions, overriding theme functions or any other customization of the raw output should also be done here. This file must start with a PHP opening tag "
Sub-themes
On the surface, sub-themes behave just like any other drupal theme. The only differences is that they inherit the resources from their parent themes. To create one, a "base theme" entry inside the .info file is needed. From there it will inherit the resources from its parent theme. There can be multiple levels of inheritance; i.e., a sub-theme can declare another sub-theme as its base. There are no hard set limits to this.
Drupal 5 and below required sub-themes to be in sub-directories of the parent theme. This is no longer the case.
Others
  • The logo and screen shot is not absolutely necessary for the theme to function, but it is recommended, especially if you are contributing your theme to the Drupal repository. Screenshots will show inside the theme administration page and the user account settings for selecting themes when the appropriate permissions are set. See the screenshot guidelines for more information.
  • To supply administrative UI settings or "features" beyond logo, search, mission, etc., a "theme-settings.php" file can be used. This is an advanced feature. More information can be found in theAdvanced settings handbook page.
  • For color module support, a "color" directory with a "color.inc" file is needed along with various support files.
  • If you want to base your work on a core theme, use sub-theming or make a copy and rename the theme.Directly modifying Bartik, Garland or Minnelli is strongly discouraged, since they are used for the install and upgrade process.
  • All non-Core or modifications to Core themes should be installed under the "sites/all/themes" directory to keep them separate from core files. If you plan to run multiple sites from a single Drupal code base, you can make a theme available to a specific site rather than all sites; read about how to set this up in Multi-site installations.

49. Compare Joomla and Drupal Terminology


  1. Joomla Template is called Theme in Drupal.
  2. Component = Module.
  3. Module = Block.
  4. Mambot/Plugin = Input filter.
  5. Menu-Horizontal = Primary Links
  6. Menu-Vertical = Navigation
  7. Dynamic Content Item = Story
  8. Static Content = Page
  9. Back-end = there is no back-end in Drupal,
  10. SEF = Clean URLs (but some docs refer to SEF, too).
  11. Section = Taxonomy Vocabulary/Term
  12. Section Title = Taxonomy Term (master)
  13. Category = Taxonomy Term (child)
  14. Introtext = Teaser
  15. Maintext = Body (see explanation below)
  16. Pathway = Breadcrumb
Other terms are the same, such as: forum discussion, editor, search, region, comment, subject/title, preview, html tag, view, edit, advertising/banner, log in/log out, profile, avatar, access control, logs, cache, site maintenance, RSS feed, parent-child and snippets.

48. Name a few Good drupal sites.

47. What are the technical differences between Joomla and Drupal?


  • Joomla only supports one Section and one Category for each content, while you can assign Drupal contents to several Sections/Categories.
  • Joomla does not support multi-site setups, whereas drupal supports multisite setups.
  • Drupal has built-in forum discussion, so you don't need to install additional modules.
  • The term Blog in Joomla is not same as blog in Internet dictionary. 'Blog' term in Joomla is actually a teaser view of contents containing: Title, Introduction and a Read More link. So, in short, 'Blog' in Joomla terminology is not 'Weblog'! If one is asking if Joomla supports a 'Blog' by default, then the answer is yes, but with a different meaning.
  • Comments on contents are not available in Joomla by default, but Drupal supports comments for all content-types by default.
  • 46. How to Install Themes in your drupal website


    1. Download the theme.
      You can download drupal themes from http://drupal.org/project/themes, as well as some external sites likehttp://topdrupalthemes.net/http://drupalthemesdownload.com/ , http://drupal2u.com/ ,http://www.sooperthemes.com/drupal-themes , http://www.rockettheme.com/drupal-themes ,http://fusiondrupalthemes.com/. Make sure the version of the theme matches your version of Drupal. Note that themes labeled "DEV" are in a development stage. They may be written for a previous/current/future version of Drupal, and they are considered unstable and should be handled with care.
    2. Extract the files.
      When you first get the theme, it will appear in a compressed file format such as 'tar.gz'. On Windows, use a program like 7-Zip to extract it. On the Mac, you can use Stuffit Expander. To extract the file using the Unix command line:
      tar -zxvf themename-drupalversionnumber.tar.gz
      You should see a list of files extracted into a folder.
    3. Upload the folder.
      FTP/Copy/SCP your files to the desired themes folder in your Drupal installation. Since the themes folder at the top level of Drupal is typically reserved for Drupal core themes, you should create a sites/all/themes/ directory and put uploaded themes there. If you are running a multi-site installation of Drupal, you can create a themes folder under sites/my.site.folder and put themes there that are specific to a particular site in your installation. Themes that will be shared between all sites should be placed in sites/all/themes.
    4. Read the directions.
      If the theme has an installation file (usually INSTALL.txt and/or README.txt), read it for specific instructions. There are themes that require special treatment to function properly.
    5. Enable the theme.
      Go to administer > site building > themes. Check the 'Enabled' box next to the theme.
    6. Optional: Make it the active, default theme.
      Check the 'default' box to make this the chosen theme for your site. Enabled alone will allow users to select the theme, if you have allowed that permission.
    7. Click the 'Save Configuration' button at the bottom.
    If you run into problems, check the themes issue queue and search the forums. If your problem hasn't already been addressed, post a question and someone will try to help you out.

    45. How to Create Content in Drupal ?

    To create content
    Administration >> Content >> Add Content
    Select the content type you want to create. There are usually one or more fields within each content type. We are providing an example of a page.
    • Title and Body fields are found in most content types.
    • Body is where you put the text for the page. "Input format" controls what code can go in the Body field. There are three (core) options: filtered HTML, PHP code, and full HTML. CCK allows you to change the name of this field; for example, you might call it "Product description."
    • Use the log message to provide information that might be useful to other authors who may edit your document later, or provide your rationale for making edits to your own or other people's content. The log message is not visible to users without the appropriate content editing rights.
    • Menu settings are used only if you are making this piece of content an item in one of your menus. It's the most efficient way to create menus. Another handbook section you may find useful is Working with the Menu.
    • Comment settings are probably best set at the site level (click Content management > Comments > Settings), but can be specified for an individual piece of content.
    • You can attach files to many content types. The "Upload" module must be enabled, and then the content type has to be set to allow this.
    • If you enabled the Path core module or added PathAuto, you'll have URL path settings next. You can enter a "normal" name here rather than being required to use "node/2" when you refer to it later on. PathAuto will automatically create a URL based on your page title.
    • Authoring sets the time stamp and creator information. The other use for this section is to control the page or story order when they are based on the time and date it was created.
    • Publishing options: only "Published" items show up on the website. You can also promote content to the front page and make the content item sticky to the top of lists.
    The final step is to preview your content and to Submit your page.

    43. Drupal Features / Drupal Benefits / Why Use Drupal ?

    42. What is Content Construction Kit (CCK) in Drupal

    The Content Construction Kit allows you to add custom fields to custom content types using a web interface. In Drupal 5.x, custom content types can be created in Drupal core, and the Content Construction Kit allows you to add custom fields to any content type. In Drupal 7 and later, most of the functionality of CCK has been absorbed into Drupal core.

    Summary and purpose of CCK?

    Drupal comes with core content types like story and blog. For such a content type, go to 'Create content' and submit a new story or blog. That's sufficient for pages of pure text and with or without attachments.

    But what if your users want to be able to submit reviews of their favorite aardvark? That would be a new content type, but I want to be able to display other stuff as well as a chunk of text for every node of that type, and I don't want it to be just attached file links.

    My options: I could hack the story.module, OR I could see if someone has already created an aardvark.module for the exact type of content I want, OR using CCK I could create a new content type called Aardvark Review.

    Using CCK, I can create a content type that has exactly the fields I need, no more or less. My Aardvark Review for instance might have:

    text field (comments on the aardvark)
    dropdown menu (aardvark color)
    audio file (recording of the aardvark's grunting)
    image (photo of aardvark)
    The CCK admin interface for creating these new content types is nice and easy: just create your new type and then click through, adding the type of fields you want it to have and what their parameters will be (how much text for the review? which colors in the dropdown menu?). There are many add-ons available in the downloads section under CCK that add new kinds of fields to your options (video field, audio field, calculated values and vastly more complicated ones).

    From the users' perspective, they'll just click on Create content > Aardvark Review and get a form that asks them to submit their review, the aardvark's color, a recording, and picture.


    Module Download Page http://drupal.org/project/cck

    41. The Drupal flow

    If you want to go deeper with Drupal, you should understand how information flows between the system's layers. There are five main layers to consider:






    At the base of the system is the collection of nodes—the data pool. Before anything can be displayed on the site, it must be input as data.
    The next layer up is where modules live. Modules are functional plugins that are either part of the Drupal core (they ship with Drupal) or they are contributed items that have been created by members of the Drupal community. Modules build on Drupal's core functionality, allowing you to customize the data items (fields) on your node types; set up e-commerce; programmatically sorting and display of content (custom output controlled by filters you define); and more. There are thousands of different options within the fast-growing repository of contributed Drupal modules. They represent the innovation and collaborative effort of everyone from individuals to large corporations.
    At the next layer, we find blocks and menus. Blocks often provide the output from a module or can be created to display whatever you want, and then can be placed in various spots in your template (theme) layout. Blocks can be configured to output in various ways, as well as only showing on certain defined pages, or only for certain defined users.
    Next are user permissions. This is where settings are configured to determine what different kinds of users are allow to do and see. Permissions are defined for various roles, and in turn, users are assigned to these roles in order to grant them the defined permissions.
    On the top layer is the site theme (the "skin"). This is made up predominantly of XHTML and CSS, with some PHP variables intermixed, so Drupal-generated content can go in the appropriate spots. Also included with each theme is a set of functions that can be used to override standard functions in the modules in order to provide complete control over how the modules generate their markup at output time. Templates can also be assigned on-the-fly based on user permissions.
    This directional flow from bottom to top controls how Drupal works. Is some new functionality you want not showing up? Perhaps you uploaded the module into the system but have not activated it yet, and this is making everything downstream non-functional (as in "A" in the diagram above).

    Maybe the module is installed and activated, but you still don’t see what you want on your site. Did you forget to place the block, as in "B"? Or are your user permission settings conflicting with what you want and your users are not set to see the output as in "C"?

    Additionally—as mentioned earlier—getting the kind of granular control you want over the details of the XHTML module outputs requires understanding this flow. Are you using a module that does exactly what you want, only you wish the markup was just a little bit different? Maybe you’d like it to use different tags, or you’d like to assign a CSS class to something? You accomplish this by copying the output function from the module and pushing it up to the functions document in your theme. Modify the code there, and when the system goes to output, it will see your customized function and use that instead.

    40. The search features in Drupal are excellent, as compared to search in other content management systems. What makes these so good?

    Drupal's search is so good because Drupal doesn't treat its content as a big bucket of text; rather, all of the fine-grained semantic information that Drupal knows about can be used to fine-tune search results. That includes the type of content, any classification information from the taxonomy system, and the usual content metadata. Inside the search engine is an extensible indexer that can accept pretty much anything. In the book, one of the examples uses Drupal to index an external non-Drupal database.

    And as usual, you can tweak and override the search system to adjust the user interface, the way content is ranked, and the way results are displayed. That said, Drupal integrates well with external search engines such as Apache Solr, Xapian, and Sphinx if the built-in Drupal search does not meet your needs.


    source: http://ostatic.com/blog/interview-john-vandyk-author-of-pro-drupal-development