0

I need to change

$render_array = entity_view($entity_type, $entities, $view_mode, NULL, TRUE);
render($render_array);

in order to force drupal to use a specific template.tpl.php (giving a specific template url).

How can I achieve this?

1 Answer 1

0

I will skip theme suggestions since your title specifically say to. There are several ways to use the menu router system to send the same node as an argument to different callback functions that handle the render process.

Most commonly used methods are Panels and Display Suite.

With Panels, you can have the panel sit at any url you want, take the node as an argument from context or url, and display parts of it or views related to it in a layout controlled by the panel manager. yousite.com/display1/nid and yousite.com/display2/nid

With Display Suite you have a similar display management, but the default (at least last time I used it) is to have the different custom displays as final tags in the url.
yousite.com/normal-node-path/display1 and yousite.com/normal-node-path/display2

If you want to do it all by yourself with custom code, you can use hook_menu to register your own page callback(s) for your own url(s). You can pass as many pieces of the url as you wish as arguments to your custom function, as long as they do not include the first word. yousite.com/this-one Menu_router does not like urls to start with variables. Then, with the information that your callback preps, you can guide your node through a custom hook_theme to use your specific template

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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