James Crook, web geek ++

Add a block within a node.tpl.php file - Drupal 7

01 Aug 2011

To insert a block directly within any node.tpl.php file, or indeed within any page.tpl.php file, you can use module_invoke.

To find the right variables to pass go to the block page within Drupal admin and hover over the 'configure' links for each block. The path tells you the module and block id that make up the first and third variables. The second one should always be 'block_view' if you want to view the block (and we do).

Example: inserting a webform block

To insert a webform block directly into a node tpl, first make sure you've enabled a block from the advanced settings on the webform itself.

Then visit 'Structure' > 'Blocks' and look at the configuration link for the webform block in question.

If the configure link is admin/structure/block/manage/webform/client-block-44/configure then the code to place it will be:

$block = module_invoke('webform', 'block_view', 'client-block-44'); print render($block);

Categories: 

Comments

15 Apr 2012

Thanks for sharing...I just used it in one of my tpl files. Placed a menu block into the content area of a certain content type. Worked perfect.

03 Oct 2013

Essential blog post! I truly enjoyed reading it, as well as most of the posts on here. That is a truly good blog, thanks for taking the time to put it together. Thank you! <a href="http://goo.gl/r9iIT7">machine computer</a> <a href="http://goo.gl/M5Q3UD">Jual voltage stabilizer</a> <a href="http://goo.gl/64vQJT">Jasa SEO Murah Bukan Pakar SEO</a> <a href="http://goo.gl/tdh1iT">Jasa SEO dan Pakar SEO</a> <a href="http://goo.gl/nRifKz">Cara Murah</a> <a href="http://goo.gl/creCyl">distributor vinyl beli vinyl importir vinyl</a> <a href="http://goo.gl/BPgErc">Beli Wallpaper Toko Wallpaper</a> <a href="http://goo.gl/UUd49V">kayu lantai parket vinyl lantai</a> <a href="http://goo.gl/ui4h9d">Masakan Khas Indonesia Resep Masakan Resep Makanan Resep Minuman Masakan Ala Indonesia</a> <a href="http://goo.gl/TawMx2">RESEP PUDING BUAH</a> <a href="http://goo.gl/CVCS5X">Resep Dadar Gulung</a> <a href="http://goo.gl/UNlmEE">Resep Sayur Lodeh</a> <a href="http://goo.gl/JmifuW">Resep Tumis</a> <a href="http://goo.gl/t2b3GJ">Resep Telur Dadar</a> <a href="http://goo.gl/w07Lyy">Resep Tempe</a> <a href="http://goo.gl/RLjuwF">RESEP IKAN</a> <a href="http://goo.gl/Em6P3K">RESEP SAMBAL GORENG</a> <a href="http://goo.gl/ciBClC">Resep Kepiting Saus Padang Paling Enak</a> <a href="http://goo.gl/a2AkmL">Resep Sate Kambing Bumbu Kecap</a> <a href="http://goo.gl/8SxKaX">Resep Daging Sapi Lada Hitam Empuk</a> <a href="http://goo.gl/iO4pSI">Resep Sup Daging Lezat Gurih Enak</a> <a href="http://goo.gl/1Hs5HK">Resep Mie Ayam</a> <a href="http://goo.gl/JyqEtq">Tips Selama Kehamilan</a> <a href="http://goo.gl/d7R8qN">Tips Yoga Ibu Hamil</a> <a href="http://goo.gl/NYt0q5">Tips Sehat Hamil</a> <a href="http://goo.gl/6VXrfH">Tanda Kehamilan</a> <a href="http://goo.gl/l497LD">Buku Tips Hamil</a>

09 May 2014

LinkedIn is a career choice and freelance salary
negotiation counter offer jobs offer freelancers with plenty of
opportunities and benefits. Managing the face of the company and talk to him about recruitment.
Get yourself enrolled in all the above areas will definitely help
you get the job you want. If you don't know someone in this town, with tons of conventions, it's all about temp work.
This includes suggesting various certification courses as well
as job seekers looking for companies that wish to hire workers from the city as well as in the UK.

27 Jun 2014

Simply wish to say your article is as surprising.

The clarity in your post is simply excellent and i can assume you are an expert
on this subject. Well with your permission let
me to grab your RSS feed to keep updated with forthcoming post.
Thanks a million and please carry on the enjoyable work.

27 Jun 2014

I was suggested this blog through my cousin. I am now not positive whether this submit is
written by him as nobody else recognise such specified
about my difficulty. You are wonderful! Thanks!

28 Jun 2014

I do not know whether it's just me or if perhaps everybody else experiencing issues with your blog.
It appears like some of the text within your content are running off the
screen. Can someone else please provide feedback and let
me know if this is happening to them as well?
This may be a issue with my web browser because I've had this happen before.
Thank you

06 Jul 2014

Allow our cause. My friend was just informed they have this.
We need to present our assistance!

06 Jul 2014

Thankfulness to my father who stated to
me about this blog, this web site is truly remarkable.

07 Jul 2014

Magnificent items from you, man. I have be aware your stuff previous to and you are just too magnificent.
I really like what you've got right here, certainly like what you're stating and the best way wherein you say it.
You are making it enjoyable and you still care for to keep it sensible.
I can't wait to learn far more from you. This is really a terrific web site.

23 Jul 2014

I am really loving the theme/design of your blog. Do you
ever run into any internet browser compatibility issues?
A few of my blog visitors have complained about my blog not working correctly in Explorer but
looks great in Safari. Do you have any recommendations to help fix this problem?

25 Jul 2014

One of the things I help my clients do is to face up to their fears,
but not in a way that is uncomfortable. Once again, these are ordered from worst
to best with higher priority placed on fastest possible earning time with the
least expense. Our friend Tim had invited Janna and me, along with another friend Greg, to his family's cottage north of Pittsburgh.

11 Aug 2014

Do you have a spam issue on this site; I also am a
blogger, and I was wondering your situation; we have developed some nice methods and we
are looking to swap strategies with other folks, please shoot me an e-mail if interested.

15 Aug 2014

Wow that was strange. I just wrote an extremely long comment but after I clicked submit my comment didn't show up.
Grrrr... well I'm not writing all that over again. Regardless, just wanted to say excellent blog!

27 Aug 2014

Spot on with this write-up, I truly believe that this web site needs much more attention. I'll probably be back again to
read through more, thanks for the information!

12 Aug 2014

My spοusе and I stumƄled over here dіfferent website and thought I might ass well
check thingѕ out. I like what I see so i am just follօwing you.
Look forward too looқing into your ԝebЬ page repeɑtedly.

17 Aug 2014

Thanks a bunch for sharing this with all folks
you actually recognise what you're speaking approximately!
Bookmarked. Kindly additionally seek advice from my site =).
We will have a link exchange arrangement among us

20 Aug 2014

I need to to thank you for this fantastic read!! I absolutely enjoyed every bit
of it. I have got you bookmarked to check out new things you post…

18 Aug 2014

I'll right away grab your rss as I can not in finding your e-mail subscription link or newsletter service.

Do you have any? Please allow me recognise so that I
may just subscribe. Thanks.

30 Jul 2014

Women: Gaining muscle and loss fat are same with man and
women. For example, if you weigh 150 pounds, your
caloric intake should be around 3,500 calories
(150 x 24). Once this state of flow is achieved,
your output of theta waves is greatly increased.

05 Aug 2014

Aw, this was an exceptionally good post. Spending some time
and actual effort to produce a great article… but what can I say… I
put things off a lot and don't seem to get anything done.

06 Aug 2014

A great deal of features and functions on these steam showers, I'm keen on the multimedia
idea along with the lighting style

06 Aug 2014

Good day! I know this is kinda off topic but I was wondering which blog platform
are you using for this site? I'm getting sick and
tired of Wordpress because I've had issues with hackers and I'm looking at options for another platform.

I would be awesome if you could point me in the direction of a good platform.

07 Aug 2014

Hey there! I just wanted to ask if you ever have any issues
with hackers? My last blog (wordpress) was hacked and I
ended up losing several weeks of hard work due to no back up.

Do you have any methods to prevent hackers?

08 Aug 2014

Peace of mind is important that bitcoin currency
can be stored and an exchange to USD funds easily transferred to our bank here
in New Mexico. It varies depending upon the condition of the patient or the person in need.
For some elders, hourly care is needed, which can be
provided by a Denver home caregiver.

09 Aug 2014

This will substantially increase the power of all of your
attacks, as well as increasing your Spell Vamp, and thus your survivability.
The consultant, disappointedly but firmly insists there's nothing he can do & apologizes again. Resting inside itself, the meditative mind awakens to an awareness of its
deep intuition, which is always present yet not always heard.

09 Aug 2014

I'm not sure why but this site is loading incredibly
slow for me. Is anyone else having this problem or is
it a issue on my end? I'll check back later and see if the problem still exists.

13 Aug 2014

Spot on with this write-up, I honestly believe that this site needs a lot more attention. I'll probably be returning to see more, thanks for the info!

16 Aug 2014

Have you ever thought about creating an ebook or guest authoring on other sites?
I have a blog centered on the same information you discuss
and would love to have you share some stories/information.
I know my viewers would value your work. If you are even remotely
interested, feel free to shoot me an e mail.

17 Aug 2014

You can find infinite amount of ideas that can be used to add to the
pizazz of a safari concept bedrooms plus living rooms.

24 Aug 2014

Good day I am so grateful I found your website, I really
found you by accident, while I was browsing on Digg for something else, Nonetheless
I am here now and would just like to say many thanks
for a incredible post and a all round thrilling blog (I also love the theme/design),
I don’t have time to read it all at the minute but I have book-marked it and
also added in your RSS feeds, so when I have time I will be back to read more,
Please do keep up the awesome b.

17 Aug 2014

Its highly recommended that if you want to power level your priest, to use the
World of Warcraft priest levelling guide. Possibly one of the best Emo records ever made, it was the perfect bridge between the
burlier Hardcore of the early days and the more melodic, slickened sounds of Farside and Sense Field.
But, I can't deny how extraordinary Brando's performance is as the head of the Corleone crime family,
Vito Corleone in The Godfather.

09 Aug 2014

Really like all these steam showers

16 Aug 2014

So können die Kinder bei einem Kindergeburtstag auf dem Museumsschiff Mannheim an einer
Fotorallye teilnehmen. Popcorn in Tüten - ein erfolgreiches
Ges Die Firma G-Corn beschäftigt sich seit geraumer Zeit
mit dem Verkauf von Popcornspezialitä. Festnetz,
Mobilfunk max.

17 Aug 2014

Thanks for sharing your thoughts on cellulite on thighs how to get rid of it.
Regards

20 Aug 2014

It's the best time to make some plans for the future and it's
time to be happy. I've read this post and if I could
I wish to suggest you some interesting things
or tips. Perhaps you can write next articles referring to this article.
I want to read more things about it!

24 Aug 2014

Howdy this is somewhat of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML.
I'm starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience.

Any help would be enormously appreciated!

15 Aug 2014

500 will be deducted from total base fare, if cancelled between 24 hrs to 48
hrs. Most of the educational institutes provide summer education. If you
see a school that you would like to learn more about
on this list, I recommend logging onto and learn more about the school.

19 Aug 2014

Hey there I am so excited I found your web site, I
really found you by error, while I was researching on Bing for something else, Anyhow I am
here now and would just like to say thank you for a marvelous
post and a all round thrilling blog (I also love the theme/design), I don’t have time to look over it all at the minute but
I have saved it and also added your RSS feeds, so when I have time I will be back to read much more,
Please do keep up the superb work.

21 Aug 2014

What i don't understood is if truth be told how you're now not actually
much more smartly-liked than you might be now.
You're very intelligent. You realize thus significantly
in the case of this topic, produced me personally
consider it from so many various angles. Its like women and men aren't involved until it is
something to accomplish with Woman gaga! Your personal stuffs nice.
All the time maintain it up!

26 Aug 2014

These are actually wonderful ideas in concerning blogging.
You have touched some pleasant factors here. Any way keep up wrinting.

21 Aug 2014

Any graduate level research paper is tough to complete and the MBA research paper is no exception. This requires that claims and
their evidence are clear to the writer and are articulated clearly to the reader.
Every person wants to be a good researcher today but there
is a whole lot of difference between a researcher and a good
researcher.

11 Aug 2014

There is certainly a great deal to know about this issue.

I really like all the points you've made.

16 Aug 2014

For latеst news youu have to go to see ԝorld-wiԀe-weband on web I foսnd
this web paǥe as a finest site for hottеst upɗates.

17 Aug 2014

Thanks designed for sharing such a nice idea, paragraph is fastidious,
thats why i have read it entirely

18 Aug 2014

The particular tools and techniques used in a business succession plan will vary based on the
goals and objectives of the four groups affected by the plan: the senior
generation business owner, the junior generation family members involved in the
business, key non-family employees, and family members not involved in the business.
When creating the chart, the number of the father is always
two-times that the number given to the child. Food
sources are chicken, fish, veal, certain cereals and liver.

20 Aug 2014

Wonderful web site, just lately been exploring forever and a day for ideas on the
best rattan furniture pieces for our home and in our garden. The website really helpedgreat blog some great
info here

24 Aug 2014

I don't even know how I ended up here, but I thought this post was great.
I don't know who you are but certainly you are going to a famous blogger if you aren't already
;) Cheers!

27 Aug 2014

If some one wants expert view regarding running a blog after
that i advise him/her to visit this webpage, Keep up the nice job.

27 Aug 2014

I'm not sure why but this weblog is loading very slow for me.
Is anyone else having this issue or is it a problem on my end?

I'll check back later and see if the problem still
exists.

10 Aug 2014

In addition, we also use them for other applications like finding cracks and defects in a variety of
manufactured goods and other objects just
like the bines in the human body. There are several admission requirements
to SPC's online program. Maintain doppler ultrasound equipment in perfect condition.

Pages

Add new comment