Getting output from PHP in XF - Could not execute callback

GazCBG

Member
Hi,

I am trying to get an output from PHP into the side bar, this is my test code

Location: library/GazCBG/Example/index.php
Code:
<?php

class Example_Test_Index {
   public static function getHtml() {
     $output = 'Hello World';
     return $output;
   }
}

?>

Then I created a template with
Code:
<xen:callback class="Example_Test_Index" method="getHtml"></xen:callback>

Then added add a widget to the side bar and included the template and I get

Could not execute callback Example_Test_Index::getHtml() - Not callable.


My end goal is to add a script to the PHP code that output HTML for a Twitch Status.
I have the Twitch Status script working in normal PHP

Thanks
 
You class should be called GazCBG_Example_index and callback should be GazCBG_Example_index in the template.

Class and callback names are the path within the library folder.
 
Top Bottom