PDA

View Full Version : How can I define global var vb:raw?


fxdigi-cash
12-17-2014, 11:53 PM
Hi,

I want to know how to register a global variable {vb:raw my_var} as a link. I'm trying to do that to avoid time wasting when I have to change a url to my images, smilies, avatars, js scripts and etc...

for example: in css templates, we use it like this ---

{vb:raw vboptions.bburl}/images/sidebar.png

or maybe like this:

{vb:raw vboptions.bburl}/clientscript/vbulletin_css/style1.css

or maybe like this:

{vb:raw vboptions.bburl}/clientscript/jquery.js

so what I want is to register a global variable such as {vb:raw new_url} and add it to links above so I can change it anytime I move from a domain to another.

like this: {vb:raw new_url}/clientscript/jquery.js

I hope the idea is clear.

Thanks,

kh99
12-18-2014, 12:01 AM
Well, if you created a new setting with new_url as the varname, then you could use {vb:raw vboptions.new_url}. To create an option you can temporarily turn on debug mode for your site, then go to the settings in the admincp, go to the group you want to add to, then click on the "Add Setting" link that will appear at the top of each group. You can also create a new setting group if you want (there's a link on the main option page).

Here's an article about turning on debug mode, if you aren't familiar with it: https://vborg.vbsupport.ru/showthread.php?t=265999

fxdigi-cash
12-18-2014, 12:09 AM
Hi kh99 (https://vborg.vbsupport.ru/member.php?u=346440), Thanks for the comments.

maybe I wasn't clear enough. I meant independent or custom url where I can use anywhere in all templates. I don't mean to change the main vb url, but rather to change url images, scripts and so on since I use a subdomain for all these stuff.

does what I say make sense? :confused:

kh99
12-18-2014, 12:15 AM
OK, maybe I don't understand. But if you create a setting, then you can enter any value you want and use it in any template. Maybe you're thinking that it's changing some other url because it has vboptions in the name? That's just the name of the array that holds all the settings. You can create a setting with any varname you want and use it for anything you want, and it won't affect anything else (as long as you choose a varname that it's already used, but I don't think it will let you create a duplicate). ETA: no, you can't create a duplicate, so you don't have to worry about that.

fxdigi-cash
12-18-2014, 01:00 AM
Thanks for the detailed answer, kh99 (https://vborg.vbsupport.ru/member.php?u=346440)

now it is clear. This is exactly what I was looking for! :)