Neuigkeiten:

Wondering if this will always be free?  See why free is better.

Hauptmenü
Advertisement:

wrap text around images

Begonnen von bojzi, Januar 01, 2005, 08:14:28 VORMITTAG

Vorheriges Thema - Nächstes Thema

bojzi

http://www.simplemachines.org/community/index.php?topic=19066.0

the problem is stated here... I want to be able to post images that have text wrapped around them. When i change subs.php the way that [unknown] said in the post above, i get an error... any ideas? thanks...


How to do it:
Sources/Subs.php, find:
// Size the font.  [size=large]HELLO![/size]
Add above it:
// Floating text/images...
'~\[float=(right|left)\](.+?)\[/float\]~' => '<div style="float: $1;">$2</div>',


Then you can use:
IMAGE HERE
Some text....


Moderator edit: added how to.
The mind is like a parachute, it only works if it's open.

[Unknown]

Can you post exactly how you're modifying Subs.php?

-[Unknown]

bojzi

Zitat'~\[float=(right|left)\](.+?)\[/float\]~' => '<div style="float: $1;">$2</div>',

And change:
'~\[hr(?:\s*/)?\]~i' => isset($disabled['hr']) ? '' : '<hr style="clear: both;" />',
'~\[br(?:\s*/)?\]~i' => '<br style="clear: both;" />',

This is what you wrote in the post about wrapping the text...

well, i just added the first line and found the two lines (hr, br) that had the same beginning, and changed them with the two lines that you wrote...
The mind is like a parachute, it only works if it's open.

[Unknown]

Sources/Subs.php, find:

// Size the font.  [size=large]HELLO![/size]

Add above it:

// Floating text/images...
'~\[float=(right|left)\](.+?)\[/float\]~' => '<div style="float: $1;">$2</div>',


Then you can use:

IMAGE HERE
Some text....

-[Unknown]

bojzi

thanks for your help, but i get that error again :(

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/bojzi/public_html/forum/Sources/Subs.php on line 1593

phpinfo if you need it...

Edit: Oh yeah, the Subs.php is totally unmodified, no additional stuff added to it.
The mind is like a parachute, it only works if it's open.

Midgard

what's on line 1593? please copy-paste on here

bojzi

This is copy-paste of the lines 1590-1595 after adding the mod:

Zitat1590: // Gotta be special for the javascript.
1591: $context['fader_news_lines'][$i] = strtr(addslashes($context['news_lines'][$i]), array('/' => '\/', '<a href=' => '<a hre" + "f='));
1592: }
1593: $context['random_news_line'] ']= $context['news_lines'][rand(0, count($context['news_lines']) - 1)];
1594:
1595: if (!$user_info['is_guest'])
The mind is like a parachute, it only works if it's open.

Midgard

Replace with:
// Gotta be special for the javascript.
$context['fader_news_lines'][$i] = strtr(addslashes($context['news_lines'][$i]), array('/' => '\/', '<a href=' => '<a hre" + "f='));
}
$context['random_news_line'] = $context['news_lines'][rand(0, count($context['news_lines']) - 1)];

if (!$user_info['is_guest'])


Please try again...

bojzi

No, nothing yet...

Zitat
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/bojzi/public_html/forum/Sources/Subs.php on line 1597

Zitat1596:{
1597: $context['user']['messages'] ']= &$user_info['messages'];
1598: $context['user']['unread_messages'] ']= &$user_info['unread_messages'];
The mind is like a parachute, it only works if it's open.

Midgard

Ums, i guess, your Subs.php crashed... whether again upload Subs.php from 'ZERO' :P or 'I don't know...'


[Unknown] help we :)

bojzi

hey, i did it :)
thanks very much for your help guys...

looks like my subs.php did have some
Zitat'];
extra groups of these signs... dunno why, but now it's workin ;) thanks! :)
The mind is like a parachute, it only works if it's open.

Midgard


[Unknown]

Are you using Dreamweaver?

-[Unknown]

bojzi

The mind is like a parachute, it only works if it's open.

James Woodcock

Great little trick, however can you alter the code to add a bit of a margin around the image so the text isnt flush with the edge of the image?

[Unknown]

Of course, just make this:

'<div style="float: $1;">$2</div>

This instead:

'<div style="float: $1; margin: 1ex;">$2</div>

-[Unknown]

nameless

I am getting the following error

ZitatParse error: parse error, unexpected T_DOUBLE_ARROW in /home/sfboarders/public_html/nameless/forum/Sources/Subs.php on line 1015

Lines 1014-1016 below

// Floating text/images...
'~\[float=(right|left)\](.+?)\[/float\]~' => '<div style="float: $1;">$2</div>',
// Size the font.  [size=large]HELLO![/size]

Skate, Snow, and Surf - SF Boarders - Bringing San Francisco Bay Area boarders together.

[Unknown]

Are you using the "faster parsecode" mod?

-[Unknown]

nameless


Skate, Snow, and Surf - SF Boarders - Bringing San Francisco Bay Area boarders together.

wildcard

Zitat von: [Unknown] in Januar 05, 2005, 04:07:24 VORMITTAG
Sources/Subs.php, find:

// Size the font.  [size=large]HELLO![/size]

Add above it:

// Floating text/images...
'~\[float=(right|left)\](.+?)\[/float\]~' => '<div style="float: $1;">$2</div>',


Then you can use:

IMAGE HERE
Some text....

-[Unknown]

How would one achieve this in 1.1 now?

Advertisement: