For example, I have a plugin called
Test
class Test_Plugin implements Typecho_Plugin_Interface { public static function activate() { Helper::addAction('Test', 'Test_Action'); //Action.php Helper::addAction('Custom', 'Custom_Action'); //Custom.php } ... .. .}
I want to add two action, which are test and custom.
This write, access to Action/test is normal, but access Action/custom but error, said can not find.
Could you please add two action to a plugin? If so, how do you write the code?
Reply content:
For example, I have a plugin calledTest
class Test_Plugin implements Typecho_Plugin_Interface { public static function activate() { Helper::addAction('Test', 'Test_Action'); //Action.php Helper::addAction('Custom', 'Custom_Action'); //Custom.php } ... .. .}
I want to add two action, which are test and custom.
This write, access to Action/test is normal, but access Action/custom but error, said can not find.
Could you please add two action to a plugin? If so, how do you write the code?
widget/do.php Code
if (isset($widgetName) && class_exists($widgetName)) { $reflectionWidget = new ReflectionClass($widgetName); if ($reflectionWidget->implementsInterface('Widget_Interface_Do')) { $this->widget($widgetName)->action(); return; }}
Indeed, the Custom_action file include path is custom/action.php, and the class name is Custom_action
One action can handle everything, and if you need to add an action, depending on how the action is accessed, you can only add a new plugins to define it.