print all the titles of a content type by php I created a content type: "period".

Then, I created instances of this content type. 

Now I would like, on a page tpl.php put the instructions, to print all the titles of the instances that I put on this content type. is it possible?
I think the "best" way (most future-proof etc.) would be to use an EntityFieldQuery:

$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'node')
  -&gt;entityCondition('bundle', 'period');

$results = $query-&gt;execute();
if (!empty($results['node'])) {
  $nodes = node_load_multiple(array_keys($results['node']));
  foreach ($nodes as $node) {
    // Do something with $node-&gt;title
  }
}


There are other options but they either involve deprecated methods or going directly into the node/revision tables, which can be a pain.

If you need this list in page.tpl.php make sure you don't put the code directly in the template file (it's bad practice and can cause problems with caching). The best place would be in a preprocess hook in your theme's template.php file, or a module file.