The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
problems: str_replace for template edits and conditionals
I'm using str_replace to try and get a plugin to modify a template. This in itself is not a problem, but as soon as I add in a conditional, it doesn't seem to be parsed when the template is run.
Here's what I'm trying to do: Code:
$disabled_add = ' $disabled /><if condition=\"$disabled==\"disabled\"\"><span style=\"color: grey\">$vbphrase[avatar_taken]</span><else />$avatar[title]</if>'; $vbulletin->templatecache['modifyavatarbit'] = str_replace(' />$avatar[title]', $disabled_add, $vbulletin->templatecache['modifyavatarbit']); When we look at the output we see that the conditional statements, instead of being evaluated are finding their way into the HTML output: HTML Code:
<input type="radio" name="avatarid" value="1880" id="rb_avatarid_1880" /><if condition="=="disabled""><span style="color: grey">Taken</span><else />Sup29</if> </label> My guess is that conditionals inserted via str_replace aren't being evaluated correctly. Is this a bug, or does anyone know of any work-arounds. I've tried to find other mods that do this but so far haven't found any. A search of this forum and google has also proved fruitless. Any help would be appreciated |
#2
|
||||
|
||||
You can't base them off conditionals, as they change into ((CONDITION) ? true : false).
|
#3
|
|||
|
|||
Quote:
Sorry, kind of muddling my way through this mod, but am learning a lot as I go |
#4
|
|||
|
|||
Quote:
It's taken me ages, but I figured it all out and wrote it up in a tutorial (or rather series of tutorials) here: https://vborg.vbsupport.ru/showthread.php?t=151332 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|