Home ›
Use drupal_set_message with print_r to see the view codeUse drupal_set_message with print_r to see the view code
Submitted by Benjamin Melançon on May 6, 2008 - 5:30pm
Searched words:
Print view definition
Moving this tip over from where I posted it at Lullabot in their 50 tiips thread.
Specifically, put this in the custom argument code:
<?php
drupal_set_message('<pre>' . print_r($view, TRUE) . '</pre>');
?>
(PHP tags used for formatting here and are not entered into the argument code textbox.
To do this on a live site without regular folks seeing, while you're online as user #1, you can use this:
<?php
global $user; if ($user->uid==1) drupal_set_message('<pre>' . print_r($view, TRUE) . '</pre>');
?>
(Note: Agaric Design Collective would never, ever, ever do debugging or development on live site. Ever. Anymore.)
Resolution
More like this
- Add action form print_r dump - for easy reference for form_alter and form theming
- Error caused by misplaced parenthesis in drupal_set_message() function with error option.
- How to print views from a theme: use PHP to insert views directly into a template
- Print information associated with a node elsewhere in page.tpl.php, using a separate template file for theming
- Using the taxonomy term associated with a node as an argument in a view


Comments
-
Good tip, another way is to use dblog eg. watchdog('debug', print_r($view, TRUE));
(BTW This captcha is horrible :D )
Post new comment