Back to vBulletin 4 Articles

[HOW TO - vB4] Making stuff right-to-left (RTL) compatible - example: images
by cellarius 31 Oct 2009

The credit for this really goes to Freddie at vbulletin.com, and I readily admit that I have blatantly stolen this little valuable bit of information from one of his comments in the alpha bugtracker. Thanks to Freddie for letting me crib off

What's this good for?

As you probably all know, vBulletin can be used with languages that are read in right to left direction. If you need to provide for this anywhere in your own styles and templates, you can use the style variable {vb:stylevar right} which can be used in css and template files. If the text orientation is standart left-to-right, it's value is "left", if its right-to-left, it's value is "right".

Example: Image with orientation

Say, you have an image or icon that in any way represents a direction, it's possible that the orientation of that image has to change along with the reading direction. An existing example would be the left or right arrow in pagination, for previous and next page. It's good practice to provide for this.

How to do it?

Assume you have an image file, for example: arrow.png

In a first step, add the current direction orientation to the file, using either left and right as suffix. We end up with an image file: arrow-left.png

Now flip the image and change the prefix accordingly. Now we have a second image file, called: arrow-right.png

In your template reference this image as follows:
Code:
<img src="images/yourfolder/arrow-{vb:stylevar right}.png" alt="" />
...and that's why I thought this little gem might be of use to some.

vblts.ru supports vBulletin®, 2022-2024