Jump to content

fractions bbcode and rte


KT Walrus

Recommended Posts

I implemented a quick bbcode for showing pretty fractions, using this php code:

{ return preg_replace( "/\s*(\d+)\s*\/\s*(\d+)\s*/i", "<span style='font-size:80%'><sup>\\1</sup>& #8260;<sub>\\2</sub></span>", $content ); }

For [fraction]3/11[/fraction] it shows as: 311 (only the fraction height is reduced by 80% so that it looks normal)

This works, but I haven't been able to figure out how to get the RTE to show the formatted fraction instead of the BBCode. What I really want is to implement a drop down menu that allows the user to just pick a formatted fraction from the drop down. Maybe all fraction up to 16th such as:

12
13 23
14 24 34
15 25 35 45

So, I've gotten half of what I want, but it occurred to me that IPS could implement this much better. I'd like to see a new dropdown in the editor to allow you to insert a fraction (from the list) and have this fraction appear formatted in the RTE editor.

    private function _buildOutput( $content )


Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...