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
Web Development Information [PHP, DRUPAL, MYSQL, MAGENTO, JQUERY, JAVASCRIPT, CSS, HTML5]
Thursday, February 13, 2014
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);
Tuesday, December 31, 2013
Embed view block or page in code or block
We can embed a views page or block in code or block.
<?php print view_embed_view('view_name', 'block_page_name'); ?>
<?php print view_embed_view('view_name', 'block_page_name'); ?>
Apply row style template in Drupal 7
We can design or apply our own design to drupal views (row style) in Drupal 7.
*) Goto Views -> Block or Page view -> Advanced -> Other -> Theme: Information.
*) Create the template file in your custom theme folder. Possible template file name can be created from "Row style output" in Theme: Information.
*) If required, please apply "Rescan template files" button.
*) Once rescan done, your template will be shown as bold.
*) Then press "Row style output" link, copy the code and paste into your template file.
*) Then you can design or apply your own design.
For Example:
Create views-view-fields--<view name>--<view machine name>.tpl.php in theme folder
And apply the following code
<div class="ownclass">
<a href="<?php echo $fields['field_link']->content; ?>">
<?php echo $fields['field_image']->content; ?>
</a>
</div>
*) Goto Views -> Block or Page view -> Advanced -> Other -> Theme: Information.
*) Create the template file in your custom theme folder. Possible template file name can be created from "Row style output" in Theme: Information.
*) If required, please apply "Rescan template files" button.
*) Once rescan done, your template will be shown as bold.
*) Then press "Row style output" link, copy the code and paste into your template file.
*) Then you can design or apply your own design.
For Example:
Create views-view-fields--<view name>--<view machine name>.tpl.php in theme folder
And apply the following code
<div class="ownclass">
<a href="<?php echo $fields['field_link']->content; ?>">
<?php echo $fields['field_image']->content; ?>
</a>
</div>
Subscribe to:
Posts (Atom)