How to use a xenForo variable within my own class

mungo

New member
I've built a simple add-on and code event listener based on the tutorial.

it works fine if i just want to replace some text (yes i know i can do this with phrases) however it doesn't when the replace alo includes a xenForo phrase (or variable for that matter).

what i am trying to do is actually add a title tag to the link back to my homepage.

here is my current code:

class Mungo_listener
{
public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
if($hookName == 'footer_links')
{
$contents = str_replace('>{xen:phrase home',' title="here is a friendly title">{xen:phrase home',$contents);
}
}
}

so two questions, how can i do this by the method i'm trying.
and
would there be a better way of doing this?
 

Kier

XenForo developer
Staff member
Phrases are compiled into the template, so you need to search for the text of the phrase, not the phrase markup.
 

mungo

New member
great thanks, i've done as you said and it works as i wanted it to.

... am slowly getting the hang of xenForo, it's very different to what i'm used to!
 
Top