Xen:callback tag [Deleted]

AndyB

Well-known member
AndyB submitted a new resource:

Xen:callback tag - In Xenforo 1.2 a new tag called <xen:callback> was introduced

In Xenforo 1.2 a new tag called <xen:callback> was introduced. This allows calling a php file directly from a template.

Here's an example that will call a file called banner.php

1) First create an index.php file and put it in the /library/Example/Banner folder
PHP:
<?php
class Example_Banner_index {
  public static function getHtml() {
    include '/home/www/banner.php';
    return $output;
  }
}
?>

2) Create a banner.php file
PHP:
<?php
$output = 'Hello World';
?>

3)...

Read more about this resource...
 
In your example, the inclusion of banner.php is rather unnecessary since the code can be placed directly into the getHtml function you have defined. However, if you need to include PHP files, this is a rather simple way to accomplish it (ie, including another application's files).
 
In your example, the inclusion of banner.php is rather unnecessary since the code can be placed directly into the getHtml function you have defined. However, if you need to include PHP files, this is a rather simple way to accomplish it (ie, including another application's files).

I prefer to use an 'include' so that I can keep all my php files in one folder for easy access and editing.
 
I prefer to use an 'include' so that I can keep all my php files in one folder for easy access and editing.

I do like your resource as it's basically what i have been doing / learning the past few days, I will also be providing a detailed tutorial for how to create a custom front page using this method (I am still playing around with my own so once it's complete / i am happy with it i shall post my tutorial and templates required for this).

Yes i agree, I am doing the same.. what i have done is created a folder called "Expertpixels" and have placed it like so: myxfinstall.com/library/Expertpixels/ <--- I then have separate folders here so that i can group my custom templates into sections just to make it easier for me to work with / easier to find if i need to edit any..

For example, any files that i have created that are used on my front page are found here: myxfinstall.com/library/Expertpixels/frontpage/ below is a example of my news template:

myxfinstall.com/library/Expertpixels/frontpage/news.php <-- this file is used on my home tab / front page to display the first post of several threads from a forum in which i post news and updates related to my latest style releases.

Darren
 
I need to call a table to a widget form an xml. I have a php file could I use this? I have widget framework and it hasta a php callback widget. Any ideas on how to do this?


Im completely out of my league with this.
 
I need to call a table to a widget form an xml. I have a php file could I use this? I have widget framework and it hasta a php callback widget. Any ideas on how to do this?


Im completely out of my league with this.
Honestly, it does not sound so easy. And there would be a lot of information needed to help you out. Maybe you could ask the developer of the widget?
 
AndyB seems to have decided that the forum for development discussions is a better place to store tutorials than the dedicated system we have for storing tutorials.
 
Top Bottom