Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4127366
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T00:09:18+00:00 2026-05-21T00:09:18+00:00

I’m working on a site for which I happen to need to embed the

  • 0

I’m working on a site for which I happen to need to embed the entire output of a node template (for a couple of content types) into various other templates. Most of the cases are embedding a node – selected in a nodereference CCK field – into a view template, so my current approach is:

  • in the view settings: add the noderef field directly as one of the fields to output (as opposed to using a relationship to make the referenced node’s fields accessible)
  • set the format for field output to “full node” – which I’ve found prints the whole node template

This is great, BUT: there are a few important variables that are used in the node template. The only way I already know of to set these is via a preprocess function, which does work… The annoyance with this method is that in the preprocess function I have to detect (by whatever is accessible there) where the template output will be embedded, so I can set the variables appropriately.

What I want to do instead:

Intuitively, it’d make way more sense to be able to call a function in my various view templates that would: a) allow me to print the whole node template, and b) pass in values for the preprocess variables. Does anyone know a function that can do this, or an alternate method?

[Thoughts so far that haven’t gotten me anywhere:

I know in similar cases, you can pass in options as arguments to theme(), according to the signature of the particular theme function that will be called. But node_view() does not provide that ability — and node_view() seems to be the proper function to call for invoking the node template, rather than theme(‘node’, …).

I see that node_view() invokes hook_nodeapi() with ‘alter’ as $op, but that is happening too late in the game; the node content will already be in HTML format by then (i.e. $node->body).]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T00:09:19+00:00Added an answer on May 21, 2026 at 12:09 am

    Well, there is hook_nodeapi($op = ‘view’), if you want to change existing elements, you give your module a high weight so that it is called last. To know when you want to customize something, you could set a custom flag on the node object, something like $node->yourmodule_inside_view_noderef = TRUE before you pass it to node_view().

    In Drupal 7, there is the so called $view_mode concept instead of just a boolean flag to show the teaser or not.

    You can define your own view_modes through hook_entity_info(), here is an example from userpoints_nodeaccess: userpoints_nodeaccess_entity_info. This allows you to react based on the view_mode in hook_node_view/hook_node_view_alter but also allows you to customize which fields should be displayed how and which view_mode should be used when the node is displayed without needing custom code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
In my XML file chapters tag has more chapter tag.i need to display chapters
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.