0

i want to display a node (from a menu callback), but when i do this:

echo node_view(node_load($_POST['classid']));

it displays the node without the page template. How do show the entire node, just like someone navigated to '/node/xxx'.

by the way, i can't just redirect to 'node/xxxx' because i need to leave the url without any parameter (stupid requirement by employers)

2 Answers 2

0

It's a bit strange that node_view is not returning a fully formatted node. The node module calls node_view inside it's own hook_menu to handle node/%nid requests.

Is there any chance that your CSS is selecting on something specific to node/%nid pages or your templates are setup in a non-standard way.

Can you show us the exact HTML string that is being returned by that function and the HTML string you are expecting?

1
  • the html returned is exactly what is generated by node.tpl.php. the node is a content type, that has page-content_type.tpk.php template. this template doesn't show on node_view above (but does show on node/xxxx) Jul 9, 2012 at 12:53
0

Only a year late.

$url = url('node/XXX', array('absolute' => TRUE));
$html = file_get_contents($url);

That will do the trick under most circumstances.

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.