How can i retreive all Nodes with a specific type
mediashock - April 23, 2008 - 15:50
I would like to select all nodes with a specific type .. using php
for example
for each node = cars
print $fieldname_value
end
can someone point me in the right direction for something like this??
thanks

(no title)
Some related modules:
http://drupal.org/project/get_content_type
Gives you node list pages using an URL like node/type/xxx
http://drupal.org/project/node_type_filter
Filters an existing node list page (e.g. a taxonomy list), using a ?type=xxx argument at the end of the URL
If you are writing your own code, you could look at the source code.
And of course the big guy
http://drupal.org/project/views
with which you can list any nodes you want and display any fields you want.
in a module or in PHP code
in a module or in PHP code ...
$sql = "SELECT * FROM {node} WHERE type='your_node_type';";$results = db_query($sql);
while ($data = db_fetch_object($results)) {
$node = node_load($data->nid);
// do some stuff, e.g. title = $node->title;
}
where 'your_node_type' = page or story etc
Ray Smith
http://RaymondSmith.com