Skip to main content

Posts

Showing posts with the label Drupal 7

Difference between session.gc_maxlifetime and session.cookie_lifetime in Drupal setting.php

ini_set('session.gc_maxlifetime', 200000); This value is for the server. It is a settings for Session Garbage Collection. If the users last visit happened before 200000s then this session is eligible for garbage collection. Since it is GC, the session value may be discarded and not compulsory. If a GC action happens after the session was made eligible for the GC, it will be deleted. ini_set ( 'session.cookie_lifetime' , 2000000 ); This value is for the browser. This is the absolute maximum time till which a browser can keep this cookie active. A 0 value here means immediate or when the browser is closed. Source: 

Difference between webform vs entityform in Drupal 7

Drupal has a lot of modules aimed at helping site builders and users add forms to their sites. What follows is a rough comparison of 2 of them. If there are any I've missed, please add them. Webform Webform is a module designed to allow you to add custom forms to the front-end of your site. Each form is stored against a node, so you add new forms to your site as if you were adding content. It's useful for things like Survey websites or just where you want a couple of forms that differ from the standard contact form. Pros Webform has been around for a long time, its very well established and has a large number of modules that  integrate with it . Webform can make a wide variety of forms with lots of different elements available out of the box. Because Webforms are nodes, they inherit all the functionality that nodes have (scheduled publishing, cloning, access control, etc.). Webforms are lighter-weight and more scalable than entity-based forms. Can handle multiple-p...

Fatal error: Call to undefined function db_fetch_object in Drupal 7

db_fetch_object no longer in Drupal 7 Now its completely new database API has been added Drupal 7 introduces a completely new database API, utilizing a number of dynamic query builders and formal prepared statements. The following Drupal 6 functions and hooks were removed: db_affected_rows ( ), db_distinct_field ( ), db_error ( ),  db_last_insert_id ( ), db_placeholders ( ), db_lock_table ( ),  db_prefix_tables ( ), db_result ( ),  db_fetch_* ( ), db_version ( ), db_rewrite_sql ( ),  hook_db_rewrite_sql ( ), pager_query ( ), tablesort_sql ( ), and others. For full information, read the Database API guide.

Drupal 7 Menu Link update through update.php

This is for hook_update_N function If we have a default menu, use below code in install file. /**  * Implements hook_update_N to create menu reports.  */ function mymodule_update_7120 ( ) {   $menus = array (     'menu_name' => 'my_parent_menu',     ' title ' => 'My parent menu title',     ' description ' => 'My parent menu description',   );   $links = array (     'link_title' => 'My menu link title',     'link_path' => 'custom_path_for_menu_link',     'menu_name' => 'my_parent_menu',     ' weight ' => 0,     ' expanded ' => 0,   );   // Save menu group into menu_custom table   // Look the table first if the data does exist   $exists = db_query ( "SELECT title FROM {menu_custom} WHERE menu_name= : menu_name", array ( ' : menu_name' => $menus [ 'menu_name']) ) -> fetchField ( );   // Save the rec...

CKFinder Installation in the CKEditor for Drupal 7 Module

Please follow the steps below;  Go to http://ckfinder.com/download and download CKfinder Unpack the contents of the installation package into the directory that contains the CKEditor module and place it in thesites/all/modules/ckeditor/ckfinder (or sites/all/libraries/ckfinder) folder. . When the files are unpacked, you should see the following file structure inside the drupal/sites/all/modules directory: Now open the CKFinder configuration file (ckfinder/config.php) and introduce the code changes described below. Firstly, remove the CheckAuthentication() function (do not worry, this function is defined in filemanager.config.php, see below): function CheckAuthentication()       <- remove it {                                    <- remove it    //WARNING : DO NOT simply...      <- remove it    ...        ...

Files that Drupal Themes Use

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: .info   (required) All that is required for Drupal to see your theme is a ".info" file. Should the theme require them, meta data, style sheets ,  JavaScripts ,  block 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 dru...

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 t...

Drupal 7 admin pages slow

So for some time I've been running Drupal 7 for my private webpage. It has been slow as hell on the admin pages. The "frontend" side works fast and without any slowdown. There are  others experiencing the same trouble . A lot of others it seems. For years I've been running Drupal now and it's only since I switched to version 7 that it started to have speed problems. It has a major slowdown on all admin pages. They take sometimes 30+ seconds to load and almost every admin page uses 10+ seconds. The high times cause PHP to throw an error (Maximum execution time of 30 seconds exceeded) that some function was running too long. I constantly got these errors on admin pages. It was barely usable. I had to reload pages multiple times (often 5+ times) to finally get them to show. Each time I had to wait till the timeout came. Furthermore the update.php page had the same problem. I couldn't update more than 2 modules for some time. Now I updated to ver...

Optimize Drupal 7

Hi, There can be a number of approaches u can think of. I am listing some of those based on my recent experinces :  1. Try to have minimum no of tpl files in your theme folder. We should avoide writing separate tpl for each type of content or node  2. Try to include internal css & js files on at the apprpriate location under speific hooks or so, sothat those don't get loaded unnecessarily  3. Try to make use of modules like cache_external_files to load external js files from ur local system and get it updated on cron run  4. Write ur code under best possible drupal way, I mean say , if we can have some code be working under page preprocess , we shouldn't write it in hook_init.  5. can take help of sites like http://gtmetrix.com/ , newrelic to check the site performance & follow the suggestions they provide  6. Combine images using CSS sprites  7. Leverage browser caching  8. Enable gzip comp...

Smart pagination or page break in Drupal 7(CK editor)

1. Install Smart Paging module   Go to Administration › Configuration › Administer Smart Paging settings.   Under 'Default page break method', select "Manual placement of page break placeholder". 2.  Install  'Ckeditor' Module   Go to Administration › Configuration > Ckediotr profiles > Filtered HTML   Edit the settings of the Advanced (Filtered HTML) Profile. Under 'Editor Appearance' section, In plugins check the required options like " Plugin for inserting a Drupal teaser and page breaks. ". 3.  Edit the configuration settings of input formats (Filtered HTML, Full HTML, Plain Text)   Go to Administration › Configuration > Text formats. Edit the required input format. For example say "Filtered HTML". Under  "Enabled filters" section, check the 'Smart Paging' option and uncheck all the remaining checkboxes. 4. Go to Content type 'article' and create new content. We will s...

Migrate to Drupal 7

Follow this page for more details  http://bhanu555prakash.blogspot.com/p/migrate-to-drupal-7.html it will continuously updates.... These link will be helpful http://btmash.com/article/2011-02-25/migrating-content-using-migrate-module http://drupal.org/migrate Thanks, Bhanu