PDA

View Full Version : {IF} as a Replacement Variable


Digital Jedi
12-12-2013, 09:05 PM
I saw this a long time ago, in someone's Admin CP when I was troubleshooting some things for them. And I've never seen it again. But it seems to work, and I'm wondering if anyone can see a flaw with this method I'm not seeing.

Basically, you just prepend all your stylevar entries with {IF}.

{IF}/misc
{IF}/buttons
{IF}/editor

Then make {IF} a replacement variable that becomes the full directory to my style folder. What this does is make it to where I only have to edit one thing if I ever decide to change the name of my styles folder. And it solves a bunch of issues with modifications like vBadvanced, when you often create pages outside the forum root, but the images are looking for them in the local directory.

Am I just now catching on or would this be considered "bad practice"?

tbworld
12-12-2013, 09:38 PM
Are you just talking about using a replacement variable in the stylevar section of the admincp. I thought it was designed to use in that fashion. I have found a few places, a replacement variable would not parse, but that could have been me misusing the situation. Anyway, it worked for me when I tried it way back when.

You literally did not mean to use "{IF}" right? You just meant something like "{foo}"?

Or did I miss your concept?

Digital Jedi
12-12-2013, 09:43 PM
I actually saw {IF} the first time I saw it used. But, yeah, I meant something like that...I'm not using {IF}... anymore. >_>

Honestly, though, this is the first time I ever found a use for a Replacement Variable for something that wasn't incidental or specific to fixing a problem I couldn't get to otherwise.

tbworld
12-12-2013, 09:49 PM
When I did use that method, which was the early days of vb4, it worked fine except for a few areas, like I stated. Since then I have not really explored if they could be used in other areas of vBulletin.

Let me know if you find out anything interesting. :)

Digital Jedi
12-12-2013, 10:05 PM
So far I've tried it for the stylevar directories and, even better, in the CSS options. It always bugged me that I always had to put the full file path there, and edit every reference to it in the CSS and the stylevars when I realized my directory name was stupid. I'm just a little perturbed that I never realized I could do this before. What can I say. It's my first day.