1

I have a custom module which displays multiple content types in tabs. My module uses a custom tpl.php which renders the tabs and the contents(of multiple types).

The challenge is to have custom tpl.php for each content types I render. The theme file node--TYPE.tpl.php works when I directly hit a node of a TYPE. But it is not used when I rendered the node content using the below code,

    $node = node_load($aTab['nid']);
    $view = node_view($node, 'full');
    $rendered = drupal_render($view);
    print_r($rendered);

What is the suggestion to have my module to render each content types using their custom theme file.

1

You shouldn't be printing it with print_r(), just try print.

$node = node_load($aTab['nid']);
$view = node_view($node, 'full');
print drupal_render($view);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.