Dannymh
Active member
Hi,
So I have a template modification on the thread_view, this modification uses the PHP Callback method.
In my original code, when It was a straight replacement, I was able to use certain variables and arrays from the parent thread.
Something like
However now that I am using a callback as I am evaluating a lot more things, I wanted to still be able to check against the thread prefix
With something like
However the callback doesn't seem to have access to $thread and as such I can't evaluate against that. I assume this is because the callback doesn't have any association with the thread its coming from.
In the short term I can solve for it by adding a long variable against each of the option array values and place them in the template mod, so the mod will have the same block of code stamped into the template but should evaluate false where it isnt needed, I just feel like perhaps its better to have the PHP callback handle the evaluation rather than the template code
Can anyone help me get thread in so I can evaluate against it?
So I have a template modification on the thread_view, this modification uses the PHP Callback method.
In my original code, when It was a straight replacement, I was able to use certain variables and arrays from the parent thread.
Something like
Code:
$0
<xf:if is="{$thread.thread_id}>58086">
<xf:if is="{$thread.prefix_id}=={$xf.options.stgame_prefix}">
<xf:include template="st_gamethread"></xf:include>
</xf:if>
</xf:if>
However now that I am using a callback as I am evaluating a lot more things, I wanted to still be able to check against the thread prefix
With something like
Code:
foreach($keyValues as $key => $value)
{
if($thread.thread_id>$options.stthreadid)
{
if($thread.prefix_id==$value)
{
return $matches[0]."<xf:include template=".$key."></xf:include>";
}
else
{
return $matches[0];
}
}
else
{
return $matches[0];
}
}
However the callback doesn't seem to have access to $thread and as such I can't evaluate against that. I assume this is because the callback doesn't have any association with the thread its coming from.
In the short term I can solve for it by adding a long variable against each of the option array values and place them in the template mod, so the mod will have the same block of code stamped into the template but should evaluate false where it isnt needed, I just feel like perhaps its better to have the PHP callback handle the evaluation rather than the template code
Can anyone help me get thread in so I can evaluate against it?