note 99315 added to xsltprocessor.registerphpfunctions
| From: | Demerit at osu1 dot php dot net | Date: | Tue, 10 Aug 2010 14:58:40 +0000 |
| Subject: | note 99315 added to xsltprocessor.registerphpfunctions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-171520@lists.php.net to get a copy of this message | ||
Let's get the terminology correct here, folks.
If you are calling a function that is residing within a class, reference it by its INSTANCE name,
NOT its class name.
class.my_class.php:
<?php
class class_name {
static function function_name($in){
return ($out);
}
}
?>
calling_document.php:
<?php
require_once('class.my_class.php');
$instance_name=new class_name();
?>
my_xslt.xsl:
<xsl:value-of select="php:function
('instance_name::function_name','garbage')" />
Developers, please provide better and more thorough examples for this function.
BTW, in 5.1.6 double-colon (::) is the only thing that works when calling a function that resides
within a class. However, you must declare your function as static. Using -> as some have
suggested (e.g., php:function ('instance_name->function_name','garbage'))
doesn't work at all, no matter how you declare your function.
If you can prove otherwise, please provide clear, working examples.
----
Server IP: 69.147.83.197
Probable Submitter: 129.237.219.190
----
Manual Page -- http://www.php.net/manual/en/xsltprocessor.registerphpfunctions.php
Edit -- https://master.php.net/note/edit/99315
Del: integrated -- https://master.php.net/note/delete/99315/integrated
Del: useless -- https://master.php.net/note/delete/99315/useless
Del: bad code -- https://master.php.net/note/delete/99315/bad+code
Del: spam -- https://master.php.net/note/delete/99315/spam
Del: non-english -- https://master.php.net/note/delete/99315/non-english
Del: in docs -- https://master.php.net/note/delete/99315/in+docs
Del: other reasons-- https://master.php.net/note/delete/99315
Reject -- https://master.php.net/note/reject/99315
Search -- https://master.php.net/manage/user-notes.php