Tag Archives: Drupal

Drupal 7: Create an id with auto increment by hook_schema

Change the int type to serial.

The below is an example:

function info_manager_schema() {
$schema = array();
$schema[‘info_manager’] = array(
// specification for  table info_manager
‘fields’ => array(
‘id’ => array(
‘description’ => t(‘The primary identifier for a record.’),
‘type’ => ‘serial’,
‘unsigned’ => TRUE,
‘not null’ => TRUE,),
‘first_name’ => array(
‘description’ => t(‘The first name of the contact.’),
‘type’ => ‘varchar’,
‘length’ => 255,),
‘last_name’ => array(
‘description’ => t(‘The last name of the contact.’),
‘type’ => ‘varchar’,
‘length’ => 255,),
’email’ => array(
‘description’ => t(‘The email of the contact.’),
‘type’ => ‘varchar’,
‘length’ => 255,),
),
‘primary key’ => array(‘id’),
);
return $schema;
}

Drupal 7: .install file not working properly (Fixed)

The below is from drupal.org:

“The hook will only be called the first time a module is enabled or after it is re-enabled after being uninstalled.”

Then, how to uninstall a module?

Open the “module” page. On the top-right corner, there is a tag name “uninstall”. Click it to open its page. From there, the module can be uninstalled.

Using PHP to Rewrite Views 3 Output

1) Go into the view, expand “Advanced” clumn;

2) Click the “Theme: information” link; It reminds you how to name the rewrite file;
3) For example:
Display output: views-view.tpl.php (File not found, in folder sites/aoyeetravel.com/themes/ao_travel/templates/), views-view–supertour.tpl.php, views-view–default.tpl.php, views-view–default.tpl.php, views-view–page.tpl.php, views-view–supertour–page.tpl.php

Note: the view name is “supertour”.

4) The files are located in the “htdocs\drupal\sites\yourdomainname.com\themes\yourthemename\templates” fold.

Fatal error: Class ‘SelectQueryExtender’ not found in pager.inc on line 15 (Drupal)

Since moving the website to the local machine. It is based on drupal 7.

It shows:

Fatal error: Class ‘SelectQueryExtender’ not found in pager.inc on line 15

Someone said that since the “registry” table is empty or doesn’t have the related entries.

It is true here. And make sure that the tables’ entries are totally moved to the name database. Otherwise, there will be other issues.