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 7877195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:17:57+00:00 2026-06-03T03:17:57+00:00

I am working with a module. I have a node id. That node id

  • 0

I am working with a module.
I have a node id. That node id is a page and it has 2 or more view blocks on it. The results of views are lists of nodes with file attachments.

I need to get all the files attached to the nodes outputted by the view on this particular page.

I work in a module file and I can supply the nid of type page where these views sit.

I could not find much help so I decided to ask for what would be the best way to approach this.

I am new to Drupal so I will appreciate a great explanation on how to approach this.

  • 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-06-03T03:17:59+00:00Added an answer on June 3, 2026 at 3:17 am

    If I understand your question correctly, you need to print the View with arguments set.
    Grab the view’s machine name and the display id (In Drupal 6 Views 2, hover your mouse pointer on the displays list (Block, Page, etc) and in the URL, you will see something like “block_4” or “page_1”. That’s the display ID. In D7 Views 3, you can set the display ID in advanced field set in right pane).

    If the View’s machine name is “my_view” and display id is “block_1”,
    you can print the view in node.tpl.php or anywhere using the below code.

    <?php
    print views_embed_view('my_view', 'block_1', array(arg(1)));
    ?>
    

    arg(1) contains the node ID. If you are putting the code in a node.tpl.php or in a it’s variation, arg(1) is always the node ID. If it goes to a page.tpl.php, make sure that arg(1) is numeric at least.

    In the View, you will have to add an argument (Contextual filter, in D7 words) to make the View get the argument correctly. You can also set the contextual filter to get the argument automatically from the URL as well.

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

Sidebar

Related Questions

I have a Drupal 7 module that creates a custom node type. It's working,
I have been working on a small file manager module in a project where
I have installed drupal fivestar module. The module is working fine on the node
I have a very basic CSV file upload module working to bulk upload my
I'm working on a module that requires a strictly decoupled interface. Specifically, after instantiating
I'm working on a module that, among other things, will add some generic 'finder'
I am working on a module that allows users to post comments on a
I am currently working on a module that takes one of our business objects
I'm writing a Drupal module that deals with creating new nodes from CSV files.
Here's the situation… So I've created a Node.js module that acts as an interface

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.