[Phpwm] Passing parameters to callback functions
David Goodwin
david at codepoets.co.uk
Mon May 19 10:18:30 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Mike Tipping wrote:
| I'm using preg_replace_callback() to replace content in a CMS system but
| need to pass some extra parameters to the call back function in
addition to
| the matches array that is passed by default:
|
| $fileContent = preg_replace_callback('/{cms id="([\d]*)"}/'
| ,array($this,'replaceContent'), $fileContent);
|
| So replaceContent is defined as
|
| Function replaceContent($matches, $year, $month)
|
| Does anyone know if I can pass the $year, $month and how to do it. I
know I
| can assign it to a class or session variable but this seems messy.
I'm not aware that you can; presumably you'd have to use either global
variables, the session or something like Zend_Registry etc.
thanks
David
- --
David Goodwin
[ david at codepoets dot co dot uk ]
[ http://www.codepoets.co.uk ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFIMUXg/ISo3RF5V6YRArJBAJ42qMLaWkIMK1kdVI2E+97quOgwLACg7yDp
9nFBGcvZaudkITsOyYjVYRc=
=nGi+
-----END PGP SIGNATURE-----
More information about the Phpwm
mailing list