Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am using views and drupal 7 . I pass arguments in the URL and i want this as view page title. This is possible by using override title check-box. But i want to modify this title. i.e do some formatting and some trim of the content and show only what i require as title. how can i do it.

share|improve this question

4 Answers 4

up vote 6 down vote accepted

If I'm not mistaken, you cannot so that in the UI. However, you can implement a hook in a custom module, take the available variables, apply your own logic and set the title you want. Here is an example: Set page title for view in Drupal

share|improve this answer
    
Hi can i get the argument passed in the URL in this hook function my_module_views_pre_render ?? so that i can modify and use it. Can i write this function in my template file? –  Hacker Sep 27 '11 at 11:18
    
The argument should be inside the $view variable passed to that function. Logic like this belongs in a custom module, not in the theme layer. –  marcvangend Sep 27 '11 at 11:35

There is now Page Title contrib module that offers Views integration as well.

share|improve this answer

You can implements with metatag module. This module allows you to automatically provide structured metadata.

share|improve this answer

found a simple solution instead of separate module

/**
 * THEME_PREPROCESS_VIEWS_VIEW
 * @param type $vars
 * 
 */
function MYTHEME_preprocess_views_view(&$vars) {

  // view block 
  if ($vars['view']->name == 'viewName') {
      //update your title
      $vars['view']->build_info['title'] = '---Tittle---';
    }
}

Replace MYTHEME with your default theme. put above code in your template.php

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.