How to render content outside of drupal instance -
i created 1 website using drupal. in drupal crated content pages in instance using wisywig editor. intention using content block outside of drupal. can please me how use content block outside of drupal (with code or else).
i mean how render content outside of drupal instance
rendering blocks , nodes straight-forward.
before can either must initiate drupal core:
define('drupal_root', getcwd()); require_once drupal_root . '/includes/bootstrap.inc'; drupal_bootstrap(drupal_bootstrap_full);
using getcwd()
assumes placing script in drupal's root.
to display blocks, use block_load()
:
$blocks[] = block_load('block',$delta); //first block display $blocks[] = block_load('block',$delta2); //second block display print drupal_render(_block_get_renderable_array(_block_render_blocks($blocks)));
for nodes, there several approaches. node_view(
node_load()
)
seems cleanest:
print drupal_render(node_view(node_load($nodeid)));
Comments
Post a Comment