Exposing your API in Drupal
API’s can be great when you want your website to communicate with other third-party sites/apps to give or request any kind of data. Learn how you can expose APIs in Drupal 10 in this brief tutorial.

seen from T1
seen from China
seen from United States

seen from United Kingdom
seen from Russia
seen from Türkiye

seen from T1

seen from T1

seen from T1
seen from China

seen from T1
seen from United States
seen from United States

seen from China
seen from China
seen from T1
seen from T1
seen from Germany
seen from China
seen from China
Exposing your API in Drupal
API’s can be great when you want your website to communicate with other third-party sites/apps to give or request any kind of data. Learn how you can expose APIs in Drupal 10 in this brief tutorial.
Handling files with Drupal (CSV import)
Drupal allows pretty smooth file management API for developers.. Here is a small piece of code in which I tried to take CSVs as input, process them to get the data and insert the values into the database..
Create a menu item for your file upload form
Define the callback for the menu item and make sure to set the form encoding
Make sure that the file imported is of CSV type (check the mime type of the file uploaded)
And finally get data from the csv And TA-DA :-)
Drupal allows pretty smooth file management API for developers.. Here is a small piece of code in which I tried to take CSVs as input, process them to get the data and insert the values into the database..
http://www.innoraft.com/blog/handling-files-drupal-csv-import
Render a block programmatically
Drupal 6:
<?php
$block = module_invoke('MODULE_NAME', 'block', 'view', MODULE_DELTA);
print $block['content'];
?>
Drupal 7:
this will print with title
<?php
$block = block_load('locale', 'language');
$output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block))));
print $output;
?>
this will print without title
<?php
$block2 = module_invoke('locale', 'block_view', 'language');
print render($block2['content']);
?>
Ref:
http://api.drupal.org/api/drupal/includes!module.inc/function/module_invoke/7
t function with context
t();
http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/t/7
An example of using context.
<?php
print t(‘TEXT TO BE TRANSLATED’, array(), array(‘context’=>‘CONTEXT NAME’));
?>