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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:14:24+00:00 2026-06-14T20:14:24+00:00

now, if the node type is article. on the term page’s left, i want

  • 0

now, if the node type is article. on the term page’s left, i want to show the latest 10 articles’s title which node type is article. i don’t want to use views, how do i do? thank you.

if i want to show the latest 10 articles’s title which node type is article on the node page’s left . how to write the query. many thanks.

ps:i found EntityFieldQuery maybe can do this, but i don’t now how to do out put it.

my code:

$query = new EntityFieldQuery();

$query
 ->entityCondition('entity_type', 'node')
 ->entityCondition('bundle', 'article')
 ->propertyCondition('status', 1)
 ->propertyOrderBy('created', 'DESC')
  ->range(0, 10);

$result = $query->execute();
  • 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-14T20:14:25+00:00Added an answer on June 14, 2026 at 8:14 pm

    The code can be something like that (using db_select())

    $query = db_select("node", "n") // select from the node table
        ->fields("n", array("nid", "title")) // fields nid, title
        ->condition("type", "page", "=") // where the node type = page
        ->orderBy("created", "DESC") // order by the newest
        ->range(0, 10) // select only 10 records
        ->execute(); // execute the query
    
    while($record = $query->fetchAssoc()) {
        print(l($record['title'], "node/" . $record['nid'])); // print the node title linked to node.
    }
    

    Another example using EntityFieldQuery():

    $query = new EntityFieldQuery();
    $entities = $query->entityCondition('entity_type', 'node')          
          ->entityCondition('bundle', 'club')
          ->propertyOrderBy("created", "DESC")
          ->range(0, 10)
          ->execute();
    
    foreach($entities['node'] as $obj)
    {
        $node = node_load($obj->nid);
        print(l($node->title, "node/" . $node->nid));
    }
    

    Performance wise: use the first method.

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

Sidebar

Related Questions

i've a node type Gallery and a menu title Gallery which shows all the
Drupal 7 field collection - If I want to theme a node page which
I have a collection of articles I want to show in my json response.
I had installed node by following article https://github.com/ry/node/wiki/Building-node.js-on-Cygwin-%28Windows%29 Now i had made a test.js
I have a node type called 'movie' which may contain several subtitle files using
I have some big tables with disc_only_copies type. Now I need change short node
I'm digging into Node.js now and the whole idea seems brilliant to me. But
i have an ASP tree view having a Node so now, i have to
After upgrading node to v0.8.1, bundled Meteor apps now throw an error: node: symbol
I have multiple Node applications (build on Express framework). Now I have placed them

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.