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();
The code can be something like that (using db_select())
Another example using EntityFieldQuery():
Performance wise: use the first method.