Advertisement:

Author Topic: wrap text around images  (Read 67667 times)

Offline bojzi

  • Semi-Newbie
  • *
  • Posts: 36
  • Gender: Male
    • FreeStyle Kings - bboying the way it was meant to be.
wrap text around images
« on: January 01, 2005, 08:14:28 AM »
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:
Code: [Select]
// Size the font.  [size=large]HELLO![/size]Add above it:
Code: [Select]
// Floating text/images...
'~\[float=(right|left)\](.+?)\[/float\]~' => '<div style="float: $1;">$2</div>',

Then you can use:
[float=right]IMAGE HERE[/float]Some text....


Moderator edit: added how to.
« Last Edit: January 05, 2005, 06:32:03 AM by A.M.A »
The mind is like a parachute, it only works if it's open.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: wrap text around images
« Reply #1 on: January 03, 2005, 04:19:48 AM »
Can you post exactly how you're modifying Subs.php?

-[Unknown]

Offline bojzi

  • Semi-Newbie
  • *
  • Posts: 36
  • Gender: Male
    • FreeStyle Kings - bboying the way it was meant to be.
Re: wrap text around images
« Reply #2 on: January 03, 2005, 05:11:09 AM »
Quote
'~\[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.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: wrap text around images
« Reply #3 on: January 05, 2005, 04:07:24 AM »
Sources/Subs.php, find:

Code: [Select]
// Size the font.  [size=large]HELLO![/size]
Add above it:

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

Then you can use:

[float=right]IMAGE HERE[/float]Some text....

-[Unknown]

Offline bojzi

  • Semi-Newbie
  • *
  • Posts: 36
  • Gender: Male
    • FreeStyle Kings - bboying the way it was meant to be.
Re: wrap text around images
« Reply #4 on: January 05, 2005, 05:32:40 AM »
thanks for your help, but i get that error again :(

Code: [Select]
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.

Offline Midgard

  • Jr. Member
  • **
  • Posts: 271
  • Gender: Male
Re: wrap text around images
« Reply #5 on: January 05, 2005, 05:34:19 AM »
what's on line 1593? please copy-paste on here

Offline bojzi

  • Semi-Newbie
  • *
  • Posts: 36
  • Gender: Male
    • FreeStyle Kings - bboying the way it was meant to be.
Re: wrap text around images
« Reply #6 on: January 05, 2005, 05:37:00 AM »
This is copy-paste of the lines 1590-1595 after adding the mod:

Quote
1590: // 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.

Offline Midgard

  • Jr. Member
  • **
  • Posts: 271
  • Gender: Male
Re: wrap text around images
« Reply #7 on: January 05, 2005, 05:42:37 AM »
Replace with:
Code: [Select]
// 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...

Offline bojzi

  • Semi-Newbie
  • *
  • Posts: 36
  • Gender: Male
    • FreeStyle Kings - bboying the way it was meant to be.
Re: wrap text around images
« Reply #8 on: January 05, 2005, 05:48:56 AM »
No, nothing yet...

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

Quote
1596:{
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.

Offline Midgard

  • Jr. Member
  • **
  • Posts: 271
  • Gender: Male
Re: wrap text around images
« Reply #9 on: January 05, 2005, 05:51:33 AM »
Ums, i guess, your Subs.php crashed... whether again upload Subs.php from 'ZERO' :P or 'I don't know...'


[Unknown] help we :)

Offline bojzi

  • Semi-Newbie
  • *
  • Posts: 36
  • Gender: Male
    • FreeStyle Kings - bboying the way it was meant to be.
Re: wrap text around images
« Reply #10 on: January 05, 2005, 06:13:40 AM »
hey, i did it :)
thanks very much for your help guys...

looks like my subs.php did have some
Quote
'];
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.

Offline Midgard

  • Jr. Member
  • **
  • Posts: 271
  • Gender: Male
Re: wrap text around images
« Reply #11 on: January 05, 2005, 06:14:57 AM »
Congratulations! :)

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: wrap text around images
« Reply #12 on: January 05, 2005, 06:32:27 PM »
Are you using Dreamweaver?

-[Unknown]

Offline bojzi

  • Semi-Newbie
  • *
  • Posts: 36
  • Gender: Male
    • FreeStyle Kings - bboying the way it was meant to be.
Re: wrap text around images
« Reply #13 on: January 06, 2005, 06:23:47 PM »
yep :)
The mind is like a parachute, it only works if it's open.

Offline James Woodcock

  • SMF Friend
  • Full Member
  • *
  • Posts: 528
  • Gender: Male
  • Freelance Journalist
    • James Woodcock's Blog
Re: wrap text around images
« Reply #14 on: January 14, 2005, 05:24:11 AM »
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?

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: wrap text around images
« Reply #15 on: January 17, 2005, 04:35:35 PM »
Of course, just make this:

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

This instead:

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

-[Unknown]

Offline nameless

  • Jr. Member
  • **
  • Posts: 118
  • Gender: Male
    • Skate, Snow, and Surf - SF Boarders - Bringing San Francisco Bay Area boarders together
Re: wrap text around images
« Reply #16 on: April 27, 2005, 08:47:10 PM »
I am getting the following error

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

Lines 1014-1016 below

Code: [Select]
// 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.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: wrap text around images
« Reply #17 on: April 27, 2005, 08:48:19 PM »
Are you using the "faster parsecode" mod?

-[Unknown]

Offline nameless

  • Jr. Member
  • **
  • Posts: 118
  • Gender: Male
    • Skate, Snow, and Surf - SF Boarders - Bringing San Francisco Bay Area boarders together
Re: wrap text around images
« Reply #18 on: April 27, 2005, 11:24:29 PM »
Are you using the "faster parsecode" mod?

-[Unknown]

yes

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

Offline wildcard

  • Semi-Newbie
  • *
  • Posts: 61
Re: wrap text around images
« Reply #19 on: June 29, 2005, 04:34:00 AM »
Sources/Subs.php, find:

Code: [Select]
// Size the font.  [size=large]HELLO![/size]
Add above it:

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

Then you can use:

[float=right]IMAGE HERE[/float]Some text....

-[Unknown]

How would one achieve this in 1.1 now?