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.
Can you post exactly how you're modifying Subs.php?
-[Unknown]
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...
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]
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 (http://www.freestylekings.org/phpinfo.php) if you need it...
Edit: Oh yeah, the Subs.php is totally unmodified, no additional stuff added to it.
what's on line 1593? please copy-paste on here
This is copy-paste of the lines 1590-1595 after adding the mod:
Quote1590: // 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'])
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...
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
Quote1596:{
1597: $context['user']['messages'] ']= &$user_info['messages'];
1598: $context['user']['unread_messages'] ']= &$user_info['unread_messages'];
Ums, i guess, your Subs.php crashed... whether again upload Subs.php from 'ZERO' :P or 'I don't know...'
[Unknown] help we :)
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! :)
Congratulations! :)
Are you using Dreamweaver?
-[Unknown]
yep :)
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?
Of course, just make this:
'<div style="float: $1;">$2</div>
This instead:
'<div style="float: $1; margin: 1ex;">$2</div>
-[Unknown]
I am getting the following error
QuoteParse 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]
Are you using the "faster parsecode" mod?
-[Unknown]
Quote from: [Unknown] on April 27, 2005, 08:48:19 PM
Are you using the "faster parsecode" mod?
-[Unknown]
yes
Quote from: [Unknown] on January 05, 2005, 04:07:24 AM
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?
Find in Subs.php:
array(
'tag' => 'ftp',
'type' => 'unparsed_content',
'content' => '<a href="$1" target="_blank">$1</a>',
'validate' => '$data = strtr($data, array(\'<br />\' => \'\'));',
),
Add before it:
array(
'tag' => 'float',
'type' => 'unparsed_equals',
'test' => '(left|right)\]',
'before' => '<div style="float: $1;">',
'after' => '</div>',
),
-[Unknown]
I know it's been a while since anyone posted in this, but I just did this to my forum and we're using 1.1 RC2 still and to add the margin it took a little guessing between the two codes but if anyone is interested its:
array(
'tag' => 'float',
'type' => 'unparsed_equals',
'test' => '(left|right)\]',
'before' => '<div style="float: $1; margin: 1ex;">',
'after' => '</div>',
),
Quote from: crappyday on October 27, 2006, 05:23:16 AM
I know it's been a while since anyone posted in this, but I just did this to my forum and we're using 1.1 RC2 still and to add the margin it took a little guessing between the two codes but if anyone is interested its:
array(
'tag' => 'float',
'type' => 'unparsed_equals',
'test' => '(left|right)\]',
'before' => '<div style="float: $1; margin: 1ex;">',
'after' => '</div>',
),
SWEET!
Thanks for the code update! i can confirm this works in 1.1RC3. :)
Edit:
and as of 12/11/06, it still works well with 1.1Final.
This works in 1.1.4 as well. But I have a question. How do I go about adding a center function where the text wraps to the left and to the right of a centered image?
Quote from: Sandmansa on April 20, 2008, 12:42:34 AM
This works in 1.1.4 as well. But I have a question. How do I go about adding a center function where the text wraps to the left and to the right of a centered image?
Do you always want the image centered?
Have you tried using the center BB code?
I know this is an old topic but... anyone knows something similar for the 2.0 version of SMF?
thank you
Hello Rockas, did you ever get this solved? If not, then I believe the same piece of code would work for SMF 2.0 RC 1 as well.
I loved this MOD!!!! now it will not work on 1.1.10. after I moved forum... I used this MOD almost every post.. can someone please update it!!!! PLEASE!!!!
and none of the package parse pages will open is so I can see to manually install it
http://custom.simplemachines.org/mods/index.php?mod=631
Actually that mod should work just fine on 1.1.10 - just try installing it as usual (with backup first etc)
Quote from: Arantor on September 05, 2009, 07:25:55 PM
Actually that mod should work just fine on 1.1.10 - just try installing it as usual (with backup first etc)
your right, I had an old ver of it saved. but I still get an error. tried all the parse sites and not one will open it so I know what file to mod manually
HERE IS THE ERROR
Installing this package will perform the following actions: Type Action Description
1. Execute Modification ./Themes/default/languages/Modifications.english.php Test successful
2. Execute Modification ./Sources/Subs.php Test successful
3. Execute Modification ./Themes/default/Post.template.php Test failed
4. Extract File ./Themes/default/images/bbc/float.gif
http://dev.smfchat.com/parser/index.php
and a few older ones I have tried as well
I just went to the mod site for the link above - http://custom.simplemachines.org/mods/index.php?mod=631 - selected 1.1.10 in the dropdown for version and hit Parse, and it gave me all the edits to apply without any fuss.
thanks for all your help. but I still get the error. I am on another computer trying it... here is what I get.
if you would not mind posting the code for the template I need to mod from above I would appreciate it.
Thanks, with your help, it helped me find the manual install off the site...
Is this solved or do you still require assistance on this issue?
it is solved for me! thanks it works great
it works for me thanks.
Good to see it's working for people.
I think it's a REALLY USEFUL feature!! Why don't add it by default? :D
There are no plans to add this as a default feature, and it adds another five lines to the 1500 already in the bbcode system that the average forum user wouldn't really follow properly.
Just because they're 5 lines why don't add 'em? And I think that a really lot of users will like this feature!
Because it's 5 lines that are called MANY times.
parse_bbc is one of the heaviest functions in SMF. It's called every post, called every message listing (for the first post in every thread), amongst others. Every line added slows that down - IMO we need to cut back not add more there.
Quote from: Arantor on December 06, 2009, 11:04:55 AM
parse_bbc is one of the heaviest functions in SMF. It's called every post, called every message listing (for the first post in every thread), amongst others. Every line added slows that down - IMO we need to cut back not add more there.
I agree, we can remove a lot of useless BBC! But now, that more than ever are growing portal/wiki/blog MODs, this tag is really useful! Yes, you can say that authors can add the tag in their MODs, but it's useful also for "normal" forum: long posts need some images floatting/text wrapping! I agree that performance is important, but there are a lot of useless tags that can be removed (and added, if admins want, with MODs), for example shadow/glow! float=left/right is - I think - a basic tag, not "stylish", it's important, not only "cool" (and useless) like shadow/glow!
Oh, I agree shadow, glow should go. I also think move and some of the others should go, but I cannot seriously see adding it.
I'm almost certain it *won't* be in 2.0. I strongly doubt it will be in 2.1 but I'll push for it.
The problem with removing features is that there are folk who will expect it to be there.
Hi :)
Actually i use this code to post my articles with float image
[html]
<img style="float: left;" src="h**p://mysite.*/imagename.jpg" alt="alt-text" title="title-text" />
[/html]
is there any way to add alt and title attribute to this mod?
i think a bbcode like this:
[img float=left alt="alternative text" title="images title"]h**p://mysite.*/imagename.jpg[/img]
(smf media gallery style) :)
Thanx for great mod.
Quick Tip for SMF 2 versions:
FIrst 2 steps are the same as in Instalation instructons for 1.1.6 but in 3rd step instead of editing ./Themes/default/Post.template.php you must edit ./Sources/Subs-Editor:
Find:
array(
'image' => 'img',
'code' => 'img',
'before' => '[img]http://',
'after' => '[/img]',
'description' => $txt['image']
),
and Add Before:
array(
'image' => 'float',
'code' => 'float',
'before' => '[float=left][img]http://',
'after' => '[/img][/float]',
'description' => $txt['float']
),
Please use [code] instead of [quote], it will help people to understand what you're saying - right now it's broken.
I replaced to code. Anyway I missed topic hint is for this mod http://www.simplemachines.org/community/index.php?topic=147006.40