Welcome to YLOAN.COM
yloan.com » code » Using Code To Display Drupal 6 Block
Games Personal-Tech Data Entry registry cruise torrent mac code virus storage uninstaller systems cisco bugs wireless codes maintenance dell update communication trojan atlanta Data Backup Data Storage Data Protection Data Recovery Anti-Virus Windows Linux Software Hardware Mobil-Computing Certification-Tests Computers & Internet Internet

Using Code To Display Drupal 6 Block

In this post we are going to look at how to easily display Drupal 6 block using codes.


At times we all are required to have reminders on some apparently simple things. We are going to share one of those snippets of code that we find very useful and thus needed quite often. We decided to share it so that along with us, even you can locate it to utilize it in your use case.

While sharing it, its good to mention we used of most of the code/concepts from the comments at http://api.drupal.org/api/drupal/developer!theme.php/function/theme_block/6.

The below PHP code provides instances of the way to display Drupal 6 block using code in a simple manner. This can be something that you put in a Drupal 6 template file or a Drupal 6 theme function.


In case you simply want to get the content of the Drupal 6 block, then you may use the following code:

$block = module_invoke('MYMODULE', 'block', 'view', 0);

print $block['content']

And if you want to print the themed version of the Drupal 6 block, then you could make use this code:

// The name of the module implementing hook_block.

$module = 'MYMODULE';

// The delta of the block, may be a number such as 0 or 1, or may be a string

// such as 'mymodule_block' depending on how hook_block was implemented.

$delta = 0;

// Get the block as an object and set the module and delta properties.

$block = (object) module_invoke($module, 'block', 'view', $delta);

$block->module = $module;

$block->delta = $delta;

// Now you can print the themed block.

print theme('block', $block);

This is very simple, but indeed very useful. So, go ahead and make use of this easy yet useful technique.

Valuebound is a leading Drupal Development Company providing Enterprise Drupal web solutions. For more information on Drupal Development, contact us at info@valuebound.com

by: valuebound
Why Unicode Split Pst Procedure Is Becoming An Imperative Need Amongst Users Coupon Code 2012- Avail Free Gift Of Offers Now! Promo Code- Save Hard Earned Money Now! How To Save On The Coupon Codes On-line Enjoy Debenhams Voucher Codes While Doing Your Shopping Knowing The Code: Mastering The Canadian Electrical Code Using A Discount Code Can Make Your Shopping Wallet-friendly! At&t Uverse Coupon Code: Fiber Optics At A Price You Can Afford Need For Psd To Joomla Coders Jabong Daily Bunch Of Codes Area Code 503, Map, Time Zone Short Codes Emerging As Convenient Mode For Bulk Sms Springfield Discount Code
print
www.yloan.com guest:  register | login | search IP(3.20.239.211) / Processed in 0.020193 second(s), 7 queries , Gzip enabled , discuz 5.5 through PHP 8.3.9 , debug code: 42 , 2017, 403,
Using Code To Display Drupal 6 Block