0

Is there any way to get page title of view and panel page using url. I tried

$normal_path = drupal_get_normal_path($path);
$item = menu_get_item($normal_path);
$title = $item['title'];

and it is giving empty title while it is working well for normal node.

Please suggest.

1

For pannel you can pass the page title in url let say xyz/page_title then add content to panel and choose New custom content in the body field your code will somewhat look like

<?php
  $title = arg(1);
  drupal_set_title($title);
?>

check screenhot for better understanding:enter image description here

For views its a simple 2 step process step1: Set the view path to take the title as wildcard i.e. your view path will be view_path/% enter image description here

step2: now change the title field on views to use the title wildcard by changing it to %1 as this is the first argument in the url enter image description here

hope it helps you :)

  • I missed out to put ,"to use php in the body field you should have php filter module enabled." – arpitr Apr 22 '13 at 15:42
  • Thank you arpitr. It can be helpful for new panels and views. But I cannot turn on php filter. :-( – cissharp Apr 22 '13 at 17:03
  • cissharp you don't need php filter turned on for changing title in views. – arpitr Apr 23 '13 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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