This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

Text wrap around images in articles?


avatar
mishima 144
From: -
Hi there,

Just a quick question, is it possible to get the text in an article to wrap around an image if its on the same line using the BBCODE format and not HTML?

A bit like this:  http://www.bbc.co.uk/news/world-middle-east-12331520

Images positioned on right or left have text that wraps to it etc.

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: Text wrap around images in articles?
avatar
Administrator
1340
From: Vienna, Austria
Yes
1 Re: Text wrap around images in articles?
avatar
OP 144
From: -
So the text that has the image on the same line has to have this BB code around it?
1 Re: Text wrap around images in articles?
avatar
Administrator
1340
From: Vienna, Austria
Open /classes/class_system.php in an editor and add after:
           $var = preg_replace( "/\[facebook=([a-zA-Z0-9-_]+)\]|\[FACEBOOK=([a-zA-Z0-9-_]+)\]/", "<object type=\"application/x-shockwave-flash\" width=\"576\" height=\"432\" data=\"   http://www.facebook.com/v/\\1\"><param name=\"movie\" value=\"   http://www.facebook.com/v/\\1\" /><param name=\"wmode\" value=\"transparent\" /></object>", $var );


the following line:
         $var = preg_replace( array( "/\[lefttext=(.*?)\](.*?)\[\/lefttext\]/", "/\[righttext=(.*?)\](.*?)\[\/righttext\]/" ), array( "<div class=\"lefttext\"><img src=\"\\1\" alt=\"\" /><br />\\2</div>", "<div class=\"righttext\"><img src=\"\\1\" alt=\"\" /><br />\\2</div>" ), $var );


Then add the following CSS to your stylesheet:
.lefttext
{
float: left;
margin: 10px;
}

.righttext
{
float: right;
margin: 10px;
}


You can use now the following two new BBCODE:
[lefttext=imageurl]imagetext[/lefttext]

[righttext=imageurl]imagetext[/righttext]

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.