Skip directly to content

When to node_load and when to access the db directly in Drupal

on Wed, 01/05/2011 - 23:45

node_load() in Drupal 6 is very efficient in that when you load a node it will keep the fully loaded node in a static array. This means, for example if you load nid 23 and need information from that node in a different place, you can simply call node_load(23) and it will return the previously loaded node. There is no charge to you. Drupal sees that it has previously loaded nid 23 and doesn’t need to make all the calls to the database or through all the hooks again, just return what we’ve already got.

Now this is all fine and well if you are working on a node that is already loaded, but what if you would like just a single column from a node that hasn’t been loaded yet? Sure you could node_load the new node (ie node_load(24)) but that’s quite a bit of work to go through for a single column. In this case you might be better off going directly to the database for the data you want.

Beware when going directly to the database. Know that going directly to the database could cause slightly different results since your data won’t be passed through the different nodeapi hooks that would normally have the opportunity to alter the data before presenting it to you. Just do a bit of research and if you are sure you don’t need any alters to the data, have at it.

Though Drupal 7 has a completely different way of handling the node_load on the back end, for the purposes we’ve discussed here you can use the same logic. Drupal 7 still loads the nodes into a static variable for future uses.

Comments

However, there are benefits of insoles that anyone seeking the best from their shoes
cannot ignore. Elmer Wheeler started out as a newspaper
ad salesman. However, this kind of use does not treat the
problem, but otherwise worsen the foot condition.

CMS in web field are the content management systems helpful to build a website instantly. Most common functions are pre-developed and customized as per the requirement of clients. Visit http://www.myessay.biz/admission-essay/ to know how drupal is better CMS then others.

Blue denim with a white shirt, irrespective of which era he or she belongs to, can add a huge plus to ones fashion quotient.
At times fashionable dresses will rate you a lot of money,
so liquorish is sure name brands for latest dresses. Social media marketing tool is an effective one
in order to promote celebrity dresses.

Here is my site: [url=http://kalihoblersj.wordpress.com/2014/08/20/apply-these-5-secret-techni...
online celebrity dress up games to play now[/url]

Although HCG is only produced by females, HCG is an effective way to drop excess excess
weight for the two genders. Failure to Diagnose an Ectopic Pregnancy - Is This Medical Negligence.
You can consult your neighbors and family members for references.

Have a look at my weblog :: [url=http://cristl09.buzznet.com/user/journal/18681433/pentagon-teach-about-a... Weight[/url]

The enduring popularity of Venetian glass ornaments and
Venetian glass jewelry is a proof that the
saying is true. Belts look best with bodycon dress that have a single color for
breaking the monotony of the same. Effectively, I've discovered a way to get gorgeous wedding gowns and even designer wedding gowns for
a fraction of the original price.

Also visit my web-site [url=http://miradecicco.buzznet.com/user/journal/18681323/learn-tiger-woods-a... dress up party games[/url]

Cynthia Minnaar is a full-time internet marketer and owner of She invites
you to visit her internet marketing training website
for more link building tips. Does your recruiter make his or her
money from your sign-up fees. But other than those who just want to communicate
with friends, old and new, social media is also currently being taken advantage by business oriented people
as a way to reach their target clients and improve their businesses.

Also visit my website :: [url=https://www.rebelmouse.com/alejandrapridgen/how-to-be-happy-at-internet-... media marketing zahlen[/url]

All in all Drupal is the best blogging platform in my opinion it has so much simplicity and everything that is neede to exchange information, now adays different blog platforms try to many widgets and gadgets and it is nice but it defeats it purpose sometimes find more info. at http://fancychannel.info

In this case you might be better off going directly to the database for the data you want.

buy pacquiao vs mayweather tickets

Very helpful information.very Nice..keep update this website,,thank you so much,
Click Here for read more

To promote everything you need a marketing sistem to convert visitors in customers. You can reach many customers aso by social network. Every day you must say right message to right target.

http://www.olivieriweb.com

Thank you for problems that you have shared in this article. I hope that will be good for those who do not know

I just love that thing. your article is my craze. i just want to tell that this thing is in the world best games in the world. you want a big heart and courage to do that. your article give nice information about that otherwise i am looking for certification tolls and i found that site http://theexamcollection.com/70-410/ that site is best for certification and windows information. this site also give you information about servers.

Drupal is one of the most famous CMS being used for web development now a days. The reason is that it helps the programmers by reducing their work by built in functions. You may orser essays online to know more about drupal and comparison with some other CMS too.

I like your post and all you share with us is up to date and quite informative.you is the assurance of help within a short period of time.
www.assignmentcrux.co.uk

Buying an essay from online is very difficult process due to having some scamming service in the online. So first of all we have to understand the service properly for ordering our essay in the online service. The education essay writing task is bit difficult to complete from the students side. Even the evaluation is very different in the academics. The essay writing evaluation on academy must be well organized, and student’s thoughts must circulation rationally from one point to the next. So students should be mentioned properly according to their self-discipline in writing. So these things should be followed by the service writers. Present language and opinions on the subject in an impartial and extensive way. Writing a self essay requires the huge amount of knowledge and skill sets. The top and best essay writing service will always keep good format and high-quality essay for the students. Therefore you can get a tension free essay from this best online writing service. http://www.clazwork.com/index.php

Education deals with the new technology, in this day we can Examcollection HP2-Z37 include the resumes planet and internet is the new technology in our society. Because the internet is so much common but in mean while we can say the internet is coming advancement in our society. HP2-Z37 Examcollection

We all want more and more followers on Instagram. So here we go more instagram followers provides us liability to get more and more followers for free.This is an amazing website with Instagram details and loads of information regarding it. Visit website.

I think every web master should know Drupal and Wordpress paltforms. researchpaperwriter

Today, I was looking for Assignmentpoint.co.uk which I got on WordPress, Drupal and Magento by programming teacher. but after reading this my concepts are clear. Thank You

I really like the way you start and conclude your thoughts. Thank you so much for this information 88H2.com

Hence they have started the portal Aces Etm. With the help of this portal Aces Etm, the L Brands controls and manages all its employees aces limited brands

tlc best buy They can use their home computer or smart phone to access the site.

Post new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or class="OPTIONS" [title="the title"].
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.