How do I pass a param in xen:callback

AndyB

Well-known member
In this thread:

http://xenforo.com/community/threads/more-assorted-things.50098/

Mike said the following:

"For advanced usage, you can also pass params to the callback via the params attribute (like in template hooks)."

My question is how would I pass a param to my php script? Currently I placed this into my thread_view template:

<xen:callback class="Andy_CalendarAdded_index" method="getHtml"></xen:callback>
 

AndyB

Well-known member
Hi xf_phantom,

Thank you so much for your link. I've been looking at that and trying to make it work, but no success.

What I would like to do is pass the thread_id to my php script.

I was hoping something like this would work:

<xen:callback class="Andy_CalendarAdded_index" method="getHtml" params="{$thread}"></xen:callback>

my php script looks like this:

PHP:
<?php
class Andy_CalendarAdded {
    public static function getHtml($content, $params) {
        echo $params;
    }
}
?>
 

AndyB

Well-known member
Yes here's the code I added to my thread_view template:

<xen:callback class="Andy_CalendarAdded_index" method="getHtml" params="{xen:array 'thread={$thread}'}"></xen:callback>
 

AndyB

Well-known member
I'm making progress. Now just have to figure out how to extract the thread_id from the $param array.
 
Top