drupal - How do I decide between theme('node', $node) and drupal_render($node->content) for programmatic $node output -


given $node, i'm trying decide between following 2 ways of outputting $node.

either

$output = theme('node', $node); 

or

node_build_content($node); $output = drupal_render($node->content); 

they both seem give similar results, there should consider before choose 1 way on other?

your output similar if there no other modules , themes altering output via theme layer.

but! if bypass theme layer, you'll start experiencing unexpected behaviour when install modules or themes , change config settings use theme layer alter node's output.

in short, bypassing theme layer, you're building error application. these error occur after hand application on (a client perhaps) starts changing settings in admin/

see decorator pattern if you're interested. drupal uses extensively.

http://en.wikipedia.org/wiki/decorator_pattern


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -