Web Development Information [PHP, DRUPAL, MYSQL, MAGENTO, JQUERY, JAVASCRIPT, CSS, HTML5]
Friday, February 21, 2014
Use file_prepare_directory() instead of file_check_directory()
In Drupal 7, use file_prepare_directory() instead of file_check_directory() from Drupal 6.
Drupal 6 file_directory_path not exists in Drupal 7
Drupal 6 file_directory_path not exists in Drupal 7. Use variable_get('file_public_path', conf_path() . '/files'); instead of file_directory_path();
The following function is return file directory relative path: drupal_realpath('public://')
The following function is return file directory relative path: drupal_realpath('public://')
Thursday, February 13, 2014
Image not imported in Drupal 7 migration from Druapl 6
In node_export drupal module having issue to import images/files in Drupal 7
Fixed:
In Drupal 7, we have to use file_create_url() instead of url() in node_export.module line no 1052 - Refer - https://drupal.org/node/1264256
Fixed:
In Drupal 7, we have to use file_create_url() instead of url() in node_export.module line no 1052 - Refer - https://drupal.org/node/1264256
Find table column in MySQL
The following query is used to show all columns in each table in a database
SELECT * FROM information_schema.columns
WHERE table_schema = 'db_name'
ORDER BY table_name,ordinal_position
SELECT * FROM information_schema.columns
WHERE table_schema = 'db_name'
ORDER BY table_name,ordinal_position
Tuesday, February 4, 2014
Load content field default image in Drupal 7
Code to get and display the Content(CCK) field information and display default image
$field_name = 'field_name';
$field = field_read_instances(array('field_name' => $field_name));
$field_fid = $field[0]['settings']['default_image'];
$image = file_load($field_fid);
$path = file_create_url($image->uri);
$field_name = 'field_name';
$field = field_read_instances(array('field_name' => $field_name));
$field_fid = $field[0]['settings']['default_image'];
$image = file_load($field_fid);
$path = file_create_url($image->uri);
Subscribe to:
Posts (Atom)