XOrgPage::gassign
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Tue, 11 Jan 2005 15:18:09 +0000 (15:18 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:27:26 +0000 (23:27 +0200)
This is sooooo useful :

instead of :

$page->assign('foo', $foo);

you can now use :

$page->gassign('foo');

beware of the fact that it cannot work in a function since it uses the global mechanism.

it still saves from a lot of pain in the plain .php top level

git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-288

include/xorg/page.inc.php

index f8dcd06..5b77edf 100644 (file)
@@ -209,6 +209,15 @@ class XorgPage extends DiogenesCorePage
     }
 
     // }}}
+    // {{{ function gassign
+    
+    function gassign($varname)
+    {
+        global $$varname;
+        $this->assign($varname, $$varname);
+    }
+
+    // }}}
 }
 
 // }}}