I'm tracking pages in Drupal. I use a drupal_get_title to call the titles of the pages, however for some pages drupal_get_title return empty like titles of views. What is missing?

The title is called from a custom module. I am using the hook_init where it's called a function where track the pages and they are saved in the database. I'm trying to save in the database the title, timestamp, path, etc. but from the views the drupal_get_title return empty (the path and timestamp is saved). The titles in the nodes are saved in the database.

How can I get the titles in the track that return empty?

  • What sort of pages does it return empty for (nodes/views/custom pages)? Also where are you calling drupal_get_title() from (theme layer/in a module/in PHP code directly inserted into a block or node)?
    – Clive
    May 2, 2012 at 11:12
  • Thanks for asking. They are templates with views embed. I need to detect all titles, including the views, templates and block and nodes. The title is called from a custom module. I saved the title in the database and I print the titles in a page with other data.
    – cabita
    May 2, 2012 at 11:39
  • I think that your issue could be related with an execution order problem stackoverflow.com/questions/1511810/…
    – cigotete
    May 2, 2012 at 17:32


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.