• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Adding custom php in to a sidebar template

#1
Sorry in advance if this has been covered.

I am trying to create a simple sidebar plugin that makes a call to an external php class and returns back with a set of names (minecraft player names from a server).

I have follow this instructions of Fuhrmann the wise here and have a working sidebar with a template.

The problem I have is adding php code in to the template that makes the call to the php class and print the names of the players.

doing
<?php
code...
?>
within a template does not seem to work.

I have tried using Kitomi's Generic script bridge within the sidebar template which does not work. I have the code I want working from a page based on the script bridge though. Just not in a sidebar.

I am new to xenforo and have tried to find a definitive guide on programming addons. Can someone please point me in the right direction.

Thanks and regards
Ratava
 

James

Well-known member
#2
You'll need to do the username fetching via an add-on and then insert it into the template via the template hooks.

How To Use Template Hooks | XenForo Community

Create a new template in the Admin CP, use XenForo to push the results to that template and then include that template in the sidebar (either manually or via hooks).
 
#3
Thanks James.

I ended up getting to work last night by creating a template helper. One call to that helper and it returns all of the info.

Thanks to Fuhrmann and all of his tutorials. (y)