Closed (fixed)
Project:
UIE Forum
Version:
5.x-1.x-dev
Component:
BBCode/Smilies
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
8 Sep 2007 at 12:54 UTC
Updated:
26 Oct 2007 at 07:11 UTC
I have enahnced the [code] bbcode tag adding the possibility to get the code "online" besides the normal "code box", with this you can have a solution like this
http://img374.imageshack.us/img374/5564/codetagcf5.png
The logic is:
- [code]text[/code] -> online code
- [code]
text
[/code] -> code box
The text used is
Write [i](code box)[/i]
[code]
function Foo()
{
echo("Foo");
}
[/code]
[i]("online" code)[/i]
And then call [code]Foo();[/code] in your code.
These are the modifies done:
- file: uieforum.module
function: uieforum_filter
line: 2412
$text = preg_replace("#\[(code|pre|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", "{{uie-code}}\n", $text);
replaced with
$text = preg_replace("#\[(code|pre|php)\](.*?)\[/\\1\](\r\n?|\n?)#si", "{{uie-code}}", $text);
The final \n for the code text is useless, since it is used by a
- file: bbcode-filter.inc
function: _uieforum_bbcode_pre_tag
return '<div class="uie_pre"><pre>'.$text.'</pre></div>';
become conditional to the fact that the text is on its own lines.
if ((substr($text, 0, 2) == "\r\n") && (substr($text, strlen($text) - 2, 2) == "\r\n"))
return '<div class="uie_pre"><pre>'.$text.'</pre></div>';
else
return ''.$text.'';
- file: css/style.css
you can define the class code.uie_pre in addition to the div.uie_pre present.
| Comment | File | Size | Author |
|---|---|---|---|
| code_tag.png | 7.77 KB | devbox |
Comments
Comment #1
daniel.hunt commentedVery nice addition there - Thanks! :)
Comment #2
(not verified) commented