Drupal: How to define variables in one module functions and call it from another in Drupal 7 -



Drupal: How to define variables in one module functions and call it from another in Drupal 7 -

i writing module drupal 7. must current $node variable in 1 function, e.g. hook_init() or similar, , variable should accessible function. found give-and-take node_load(arg(1)) , author of solution said performance no concern because of caching.

so, should phone call node_load() in every function need not beingness afraid of performance issues of there other ways pass variables between module functions?

to more exact: i've placed block module on pages node types , in hook_block_view function need access current node object. i'm succeeded using node_load far. maybe there improve way.

thanks in advance!

in drupal 7 node_load() calls entity_load(), caches results, if phone call node_load() twice, returned cache.

using node_load() improve solution passing global variables between modules, if utilize third-party caching modules (apc, memcached or other). if care performance seek utilize 1 of these modules (i prefer memcached).

drupal-7 drupal-modules

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -