Srilatha Marru's Blog
Enable multiple file upload in Drupal 7

Problem:  To add multiple file uploads to each page.

Solution:   In drupal 7 file field exists in the core modules as opposed to adding a file field withh cck in drupal 6.

  1. Enable the file field in the drupal core modules.
  2. Go to content types and manage fields and add the file field to the basic page type or article if needed.  (at admin/structure/types/manage/page/fields)
  3. Now go to file settings (click on edit for the file field).
  4. Got to “File field settings”  and select the number of values.  Select the number which will be the max number of files you will upload for a page.
  5. And save settings.

There you go and you can upload multiple files for each page in drupal.

 

Srilatha Marru's Blog
Drupal Logout Bug

In Drupal 6.3 or less versions, there is bug in the drupal logout functionality.  This seems to be cache related.

If I am logged in to two browser tabs on Firefox and tried to logout in one tab and refresh the site in another tab I see the below problem -
Problem: If I tried to login or logout it says access denied but it shows the admin section links at the top.  When i click on any of the admin links it says access denied.

So you might overcome this issue, by changing the line
header(“Cache-Control: store, no-cache, must-revalidate”);
to
header(“Cache-Control: no-store, no-cache, must-revalidate”);

in function drupal_page_header() in ./include/bootstrap.inc

And clear the cache and refresh your page.

You can also find some insights at http://drupal.org/node/197786

Srilatha Marru's Blog
Drupal creating subnavigation menu and setting parent link active

Have you ever thought of creating a sub navigation menu in drupal and setting the parent section tab active in main navigation. Really it was a tough thing for me. Now I know it and I will explain you how.

To create a sub navigation you must have the main navigation set up either with primary links or secondary links.

To create the main navigation in drupal.
1. Create content node. While creating the content page, under menu settings select the parent item as primary links or secondary links.
2. Customize css of primary links or secondary links accordingly.
3. In css, use active and active-trail classes in primary links or secondary links to set the active state of any link.

To create sub navigation for any section in main navigation follow the below steps. (I am assuming primary links is set up as the main navigation. Any of secondary links or primary links can be set up as main navigation)
1. Always create the content first. Create content >
2. While creating content, under the menu settings, select one of the items in primary links as the parent item.
3. Repeat the above 2 steps for all the sub navigation pages under a section in main navigation.
4. Go to administer>menus> and add a menu.
5. Add items to the created menu.
6. Go to administer>blocks. Menu items will be shown in the blocks. Blocks can be assigned to any predefined regions.
7. Configure the blocks to display the block only in certain pages.

Then you should be able to see the sub navigation in the desired pages with selected section active in main navigation.



AUTHOR

profileWeb Developer working in advertising agency.

Recent tweets

The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.