Difference between revisions of "Drupal file list"

From WolfTech
Jump to navigation Jump to search
(Working on New View)
Line 27: Line 27:
 
Now that we have created a 'File' type to hold our files and a vocabulary to group them, we must make a View to display them.
 
Now that we have created a 'File' type to hold our files and a vocabulary to group them, we must make a View to display them.
  
===Creating A New View===
+
===Defining The View===
  
 
Return to the ''Administer'' menu and click on ''Views'' under the ''Site Building'' category. There should already be a few views listed, but we want to create a new one. Click on ''Add'' near the top of the screen. Name your view 'file_view', define the view's access levels, and add a short description such as, "Lists all file content types." Under the ''Page'' tab, check ''Provide Page View'', give the view a URL such as 'view/files', and select 'List View' from the drop-down box under ''View Type''.
 
Return to the ''Administer'' menu and click on ''Views'' under the ''Site Building'' category. There should already be a few views listed, but we want to create a new one. Click on ''Add'' near the top of the screen. Name your view 'file_view', define the view's access levels, and add a short description such as, "Lists all file content types." Under the ''Page'' tab, check ''Provide Page View'', give the view a URL such as 'view/files', and select 'List View' from the drop-down box under ''View Type''.
 +
 +
===Defining The View's Fields===
  
 
Under the ''Fields'' tab, we need to create three fields to sort the data. From the ''Add Field'' drop-down box, select 'Node: Title' and click ''Add Field''. Under ''Option'' select 'As Link' and under ''Default Sort'' select 'Ascending' when the new field appears in the ''Fields'' table. Create two more fields, a 'Taxonomy: Term' and a 'File: Name', and set their ''Handler'' drop-downs to 'With Link' and 'With Download Link', respectively.
 
Under the ''Fields'' tab, we need to create three fields to sort the data. From the ''Add Field'' drop-down box, select 'Node: Title' and click ''Add Field''. Under ''Option'' select 'As Link' and under ''Default Sort'' select 'Ascending' when the new field appears in the ''Fields'' table. Create two more fields, a 'Taxonomy: Term' and a 'File: Name', and set their ''Handler'' drop-downs to 'With Link' and 'With Download Link', respectively.

Revision as of 13:36, 28 February 2008

How To Create A Taxonomy Based File List In Drupal

This page will guide you in setting up a list of uploaded files in Drupal. Hopefully the information contained in this tutorial will be as deep as Drupal's learning curve is high (if ever that were possible).

Create File Content Type

To begin, you should have administrative privileges and the Views and Taxonomy modules should be installed.

Bring up your Administer menu and navigate to Content Types under the Content Management category. We need to create a new content type to hold our uploaded files, so click Add Content Type near the top of the screen. Under the Identification tab, name the content type 'File' of type 'file' and write a brief description such as, "A node to hold an attached file." Skip the Submission Form tab. Under the Workflow tab, make sure that the Default Comment Setting is set to 'Disabled' and Attachments are enabled. Save your new content type.

Cool, you've created a content type to hold your uploaded files.

Creating And Populating A Vocabulary

We are about to define a list of terms (a vocabulary) to define our new File content type.

Adding A New Vocabulary

Return to the Administer menu, navigate to Categories, again under the Content Management category, and click on Add Vocabulary near the top of the screen. Name your new vocabulary 'File Type' and add a description such as, "Different categories of files." The Types option box should only recognize the content type 'File' and term Hierarchy should be disabled. Before saving, make sure you check the Required option, so that every File content type will have an associated word in the vocabulary. Go ahead and submit your vocabulary.

Generating Terms

Now that we have created a vocabulary, it will show up on the Categories page under the name 'File Type'. To populate the new vocabulary, click the Add Term link under the 'File Type' tab. Give the term a Name and a short Description before submitting it. You can repeat this step to add any other 'File' terms to your vocabulary. Once finished, you can click List Terms under 'File Type' on the Categories page to view or edit the terms you have added to the vocabulary.

Creating A List View

Now that we have created a 'File' type to hold our files and a vocabulary to group them, we must make a View to display them.

Defining The View

Return to the Administer menu and click on Views under the Site Building category. There should already be a few views listed, but we want to create a new one. Click on Add near the top of the screen. Name your view 'file_view', define the view's access levels, and add a short description such as, "Lists all file content types." Under the Page tab, check Provide Page View, give the view a URL such as 'view/files', and select 'List View' from the drop-down box under View Type.

Defining The View's Fields

Under the Fields tab, we need to create three fields to sort the data. From the Add Field drop-down box, select 'Node: Title' and click Add Field. Under Option select 'As Link' and under Default Sort select 'Ascending' when the new field appears in the Fields table. Create two more fields, a 'Taxonomy: Term' and a 'File: Name', and set their Handler drop-downs to 'With Link' and 'With Download Link', respectively.