PDA

View Full Version : Raw Block Data? Responding variable to width change?


Inked_Mono
01-12-2017, 04:53 AM
Hey there, everyone!

So I've been playing around with the vBExperience plugin, and I've hit a bit of a hard spot. I'm adjust the width of the progression bars, but unfortunately the part that would "fill in" to match the appropriate percentage isn't keeping up.

Image: http://i.imgur.com/g6iInau.png

I've taken a look into the code, and it seems the green part is responsible;

<dt class="aboutme_left">
<div title="{vb:raw block_data.xperience_gfx_level}" style="width:130px; height:11px; margin-bottom:2px; background-image:url({vb:raw vboptions.bburl}/xperience/progress/{vb:raw vboptions.xperience_bar_colour_level}_faded.png);">
<div title="{vb:raw block_data.xperience_gfx_level}" style="width:1px; height:11px; margin-bottom:2px; background-image:url({vb:raw vboptions.bburl}/xperience/progress/{vb:raw vboptions.xperience_bar_colour_level}_left.png); display:inline; float:left;"></div>
<div title="{vb:raw block_data.xperience_gfx_level}" style="width:1px; height:11px; margin-bottom:2px; background-image:url({vb:raw vboptions.bburl}/xperience/progress/{vb:raw vboptions.xperience_bar_colour_level}_right.png); display:inline; float:right;"></div>
<img alt="{vb:raw block_data.xperience_gfx_level}" src="{vb:raw vboptions.bburl}/xperience/progress/{vb:raw vboptions.xperience_bar_colour_level}.png" width="{vb:raw block_data.xperience_levelp}" height="11" />
</div>

Does anybody know where I would find this within vBulletin to edit it to account for the new width changes?

Thank you in advance!

cellarius
01-12-2017, 08:47 AM
Without knowing vBExperience, one can hardly tell you more than: In a plugin. You need to find the plugin that registers that variable for the postbit (I assume) template.

Such questions are really better asked in the thread for that specific addon.

Inked_Mono
01-12-2017, 09:09 AM
Without knowing vBExperience, one can hardly tell you more than: In a plugin. You need to find the plugin that registers that variable for the postbit (I assume) template.

Such questions are really better asked in the thread for that specific addon.

Well, I've learned that each point in the progress is accounted for by the initial width. In other words, the original width was at 102px, knocking off 2px for the borders on each side, and the scale itself gave 1px per 1%. I think... I might be boned on this one, seeing as how I don't imagine I could rewrite the algorithm for counting in parts of a pixel (with my modified width being at 130px).

cellarius
01-12-2017, 09:39 AM
You know you can do math in templates? You may not even have to tamper with the PHP side of things at all.

If you want examples, just search your templates for {vb:math in AdminCP.

Perhaps this will work for you?
{vb:math {vb:raw block_data.xperience_levelp} * 1.3 - 2}

Although I have no idea how that will work out regarding the decimals, rounding etc.

Inked_Mono
01-12-2017, 09:25 PM
You know you can do math in templates? You may not even have to tamper with the PHP side of things at all.

If you want examples, just search your templates for {vb:math in AdminCP.

Perhaps this will work for you?
{vb:math {vb:raw block_data.xperience_levelp} * 1.3 - 2}

Although I have no idea how that will work out regarding the decimals, rounding etc.

Thank you! I'll give it a shot and see what happens.

Edit: It doesn't seem to have worked. Thanks anyways!

cellarius
01-13-2017, 06:16 AM
What did not work? What's the result of the equation (should be visible in the page source)?

Inked_Mono
01-13-2017, 07:36 AM
The equation itself doesn't seem to pan out. I'd amended all necessary instances of the above line to match yours and the width still pulls to 1% = 1px.

I can PM you the forum link if that would help!

cellarius
01-13-2017, 11:46 AM
Try this:

Replace
width="{vb:raw block_data.xperience_levelp}"

with
style="width: {vb:raw block_data.xperience_levelp}%;"