Permalink
Browse files

Merge pull request #42 from thisislawatts/master

Easy Variable Dumping
  • Loading branch information...
2 parents a6aa285 + 4914948 commit 3de660794b8aaaee3cb8aa74c77a9964a6c1b44c @kolber committed Apr 17, 2012
Showing with 19 additions and 0 deletions.
  1. +19 −0 extensions/twig-extensions.inc.php
@@ -25,12 +25,30 @@ public function getFunctions() {
return array(
'sortbydate' => new Twig_Function_Method($this, 'sortbydate'),
'sortby' => new Twig_Function_Method($this, 'sortby'),
+ 'debug' => new Twig_Function_Method($this, 'var_dumper'),
+ 'pebug' => new Twig_Function_Method($this, 'var_dumper_pre'),
'get' => new Twig_Filter_Method($this, 'get'),
'slice' => new Twig_Filter_Method($this, 'slice'),
'resize_path' => new Twig_Filter_Method($this, 'resize_path'),
);
}
+ #
+ # dump out our var for easy debugging
+ #
+ public function var_dumper($input) {
+ var_dump( $input );
+ }
+
+ #
+ # dump out our var for easy debugging ++ Now with Extra Pre's
+ #
+ public function var_dumper_pre($input) {
+ echo "<pre>";
+ print_r( $input );
+ echo "</pre>";
+ }
+
#
# manually change page context
#
@@ -62,6 +80,7 @@ function resize_path($img_path, $max_width = '100', $max_height = '100', $ratio
}
}
+
#
# allow offsetting and limiting arrays
#

0 comments on commit 3de6607

Please sign in to comment.