function _token_example_get_node in Examples for Developers 6
Same name and namespace in other branches
- 7 token_example/token_example.module \_token_example_get_node()
Build a list of available content.
Related topics
File
- token_example/
token_example.module, line 161 - The Token API module.
Code
function _token_example_get_node() {
if (!user_access('access content') && !user_access('administer nodes')) {
return array();
}
$sql = "SELECT n.nid, n.title FROM {node} n WHERE n.status = %d ORDER BY n.created DESC";
$query = db_query_range(db_rewrite_sql($sql), 1, 0, 10);
$nodes = array();
while ($result = db_fetch_object($query)) {
$nodes[$result->nid] = $result->title;
}
$nodes = array_map('check_plain', $nodes);
return $nodes;
}