The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#4
|
||||
|
||||
![]() Quote:
In any case, what your replacing is inside a php single quoted string. So your replacement can be only html. (Well, it could actually be any php code you wanted, as long as the result of your replacement ends up as valid php). If your replacement contains any single quote characters, they would have to be escaped with backslashes or else they would cause an error when the template is rendered. Quote:
Quote:
Quote:
In short, you need to do the work of the template compiler before you do the replacement, but it's not difficult because the template tags just get converted to php code. For the replacement you posted above, you coudl try something like this: Code:
$find = '<div id="thread_active_users"><p>' ; $replace = " <!-- Refresh Button -->\n"; if ($vbulletin->options['active_users_onoff']) $replace .= '<button onclick="showUsers()" type="button" style="float:left;"> ' . htmlspecialchars_uni($vbphrase['refresh_button']) . '</button>'; $replace .= $find; $vbulletin->templatecache['SHOWTHREAD'] = str_replace($find, $replace, $vbulletin->templatecache['SHOWTHREAD']); (I made the assumption that the newline is just missing, but like I mentions above, you might have to look at the compiled template to figure out what $find should be). The call to htmlspecialchars_uni() should take care of any quotes or special characters that might be in the phrase text. ETA: Actually, now that I look at the above again, I guess you'd only want to do the replacement if the options was true, so something like this may be better: Code:
if ($vbulletin->options['active_users_onoff']) { $find = '<div id="thread_active_users"><p>' ; $replace = ' <!-- Refresh Button --> <button onclick="showUsers()" type="button" style="float:left;"> ' . htmlspecialchars_uni($vbphrase['refresh_button']) . '</button>' . $find; $vbulletin->templatecache['SHOWTHREAD'] = str_replace($find, $replace, $vbulletin->templatecache['SHOWTHREAD']); } |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|