Published on May 1st, 2007 by dprice
Being both a web nerd and Physics student, I decided it was time for BBpress to meet up with MathML.
Here’s the steps I took to get it crankin’:
- Made a copy of the default ‘kakumei’ template, then renamed the folder ‘physics’, my new template name. I then put a copy of ASCIImath.js in there. This does all the hard work.
- Changed the physics/header.php from:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php bb_language_attributes( '1.1' ); ?>>
to:
<?xml version='1.0' encoding='iso-8859-1'?>
<?xml-stylesheet type="text/xsl" href="http://www.w3.org/Math/XSL/mathml.xsl"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en"
xmlns:pref="http://www.w3.org/2002/Math/preference"
pref:renderer="css">
It’d probably still work if you didn’t bother with this step, but seeing as BBpress is making XML we may as well.
- Added
<script type="text/javascript" src="<?php echo bb_path_to_url( dirname(__FILE__) . '/ASCIIMathML.js'); ?>"> to physics/header.php – this loads the ASCIIMathML.js javascript and does a majority of the MathML magic.
- Opened bb-includes/formattingfunctions.php and edited this:
function code_trick( $text ) {
$text = str_replace(array("rn", "r"), "n", $text);
// $text = preg_replace("|<code>(.*?)</code>|e", "'<code>' . encodeit('$1') . '</code>'", $text);
// $text = preg_replace("|n<code>(.*?)</code>|se", "'<pre><code>' . encodeit('$1') . '</code></pre>'", $text);
return $text;
}
To turn off the backtick code replacement – this is what ASCIIMath.js does!
That was it. I’ll zip it all up then post it up here. Ideally, it’d be better to not comment out any of the bb-include/ files – if anyone has any suggestions, let me know.
Published on May 1st, 2007 by
Is there a simple way for ONLY the administrator of the forum to be able to input embedded javascript into posts?
She wants to include some banner ads from other companies, and getting these in the right format is turning into a real headache…..
they are published like this…
<img src="http://track.webgains.com/link.html?wglinkid=2995&wgcampaignid=23815&js=0" border="0" alt=""/>
but the image plugin only allows .jpg .gif etc.
Could that be disabled only if the ADMIN was posting the entry?
Published on April 30th, 2007 by
I am working on adding a “Most Viewed Topics” list to my bb-Topic-Views plugin, and I’m getting hung up on one little thing. This is the code I am using to pull the topic ID and # of views from the topicmeta table:
$most_viewed = (array) $bbdb->get_results("SELECT topic_id, meta_value FROM $bbdb->topicmeta WHERE meta_key='views' ORDER BY meta_value DESC");
I then use array_slice to shorten the list to the number of posts the user wants to have listed. The only problem is that the results are sorted out of order.
For instance, a post with 5 views would come before a post with 40, because 5 is higher than 4. In other words, any post with a single-digit number of views is sorted above posts with a double-digit number of views.
Has anyone ever had this problem? Any ideas how to fix it?
Published on April 30th, 2007 by andersson
PurposeGames is one of my sites. It’s basically a site for anyone that wants to learn something new in the most efficient way possible; by creating a game around that very subject. It allows for anyone to easily create games and play/rate games by other members. I’ve actionscripted a game engine and a game creation module to allow for anyone to create games via their own pictures and drag and drop.
I use bbpress for the forum section, and actually liked the user handling so much that I kept the authentication engine for all of the site. I’ve extended it in the following manner:
– Elaborating on the bozo concept to exclude games created by a bozo, ratings doesn’t count for bozo’s and comments to games by bozos gets treated like forum entries by bozos.
– Added a vast number of statistics to the dashboard to see what member’s are doing, creating, rating, commenting, forum entries, top lists etc.
– Extending profile pages to show member’s games, comments to the games created by member etc.
– Keeping the base of the style of the forum, extending it to fit the way I like my site to look.
Concepts I like most about bbpress include the sanitize methods (very fast, perfectly implemented in my opinion), the user object; extending it is endless and very easy with the meta-concept, the tags concept, and the bozo concept and of course the table-free layout. The Akismet utilization is very nice also.
Concepts that I’ve excluded or re-written: Db-connection open/close (not optimized for my type of site), the plugin concept (my extensions are therefore “include”-based i.e. I’m not utilizing the various hooks available). I have not cluttered the code of any standard files with my code, other than adding an include statement where needed. I also had to re-route the “include header”-call of the admin panel to be able to add new parent sections to keep child sections. No biggie really but quite strange.
I rate bbpress as 4 out of 5 as code architecture goes being able to extend it and to use it as authentication foundation. Near superb. As forums goes, it falls into the category of “less is more, but not enough” 
Check my way of using bbpress at www.purposegames.com
Feel free to comment on what you like and don’t like. Thanks.
David Andersson
Creator of purposegames.com
Published on April 30th, 2007 by
i am sorry to see that tag can’t work for chinese
Published on April 29th, 2007 by
bb-Topic-Views keeps track of how many times each topic has been viewed, and then displays the count alongside the title of the topic on the front page, on forums pages, and on tags pages.
The plugin is written in such a way that it does not double-count views when a visitor browses to a different page in the same topic. If no view count record exists for a specific topic, the plugin will create a record for it. Rather than setting the initial view count to zero, the plugin sets it to the number of posts in the topic, because it has obviously been viewed at least as many times as people have posted in it! This is especially nice for adding the plugin to existing bbpress forums so the view count isn’t zero for every single topic.
You can download it here: http://blog.wittmania.com/bb-topic-views
You can see it in action here: http://blog.wittmania.com/bbpress
—
By the way, I’ve only tested this plugin in browser environments where cookies were enabled. This plugin doesn’t set any cookies (directly, anyway), but it does use session variables which are usually passed as cookies. So, if anyone runs into any bugs, please let me know!
I’m also very open to suggestions as to how I could streamline or improve the code. Thanks!
Published on April 29th, 2007 by
Does anyone know of a way to include wordpress profile data (posts for example) into the bbpress profile page?
Published on April 28th, 2007 by
I am working on a “Topic Views Count” plugin, and I’m just about finished with it. You can see a working version of it here: http://blog.wittmania.com/bbpress/, and see the source code as it is right now here: http://blog.wittmania.com/files/bb-topic-views.txt
The only thing holding me up is this; I can’t figure out a way to keep the views count from including page views. For example, when page one of a topic loads, the view count will go up by one. But, when page two loads it will also go up by one. So, a visitor has only viewed the topic once (albeit they’ve viewed more than one page), but the counter has registered two views).
I know this isn’t a huge deal, and a counter that over-counts is better than no counter at all. Still, I was wondering if anyone would have any ideas. I’d like to avoid using cookies, if possible, because I have no experience with them at all to even know where to start.
Any ideas? I’m also open to any other ideas or suggestions for the rest of the code.
Thanks!
Published on April 28th, 2007 by dprice
Ok, I’ve been poking around the forums, found out how to get new allowed tags (thanks to Louise Dade + others) and now want to add MathML tag support, so users can post MathML.
A big problem is that the editor box seems to add line break <br /> tags to every line – how do you turn this off?
The array I’m using in the plugin is:
`$tags = array(
// XHTML elements:
'a' => array(
'href' => array(),
'hreflang' => array(),
'title' => array(),
'rel' => array(),
'xml:lang' => array()),
'abbr' => array('title' => array()),
'acronym' => array('title' => array()),
'b' => array(),
'bdo' => array(
'dir' => array(),
'xml:lang' => array()),
'blockquote' => array('cite' => array()),
'br' => array(),
'code' => array(),
// 'del' => array('datetime' => array()),
'dd' => array(),
'dl' => array(),
'div' => array(
'dir' => array(),
'xml:lang' => array()),
'dt' => array(),
'em' => array(),
'i' => array(
'dir' => array(),
'xml:lang' => array()),
// 'ins' => array('datetime' => array(), 'cite' => array()),
'li' => array(),
'ol' => array(),
'p' => array(),
'pre' => array(),
// 'q' => array(),
// 'strike' => array(),
'span' => array(
'dir' => array(),
'xml:lang' => array()),
'strong' => array(),
'sub' => array(),
'sup' => array(),
'u' => array(),
'ul' => array(),
// MathML elements:
'math' => array(
'xmlns' => array(),
'mode' => array()),
'mo' => array(
'lspace' => array(),
'rspace' => array(),
'fence' => array(),
'separator' => array()),
'mi' => array('mathvariant' => array()),
'msub' => array(),
'msup' => array(),
'msubsup' => array(),
'mfrac' => array('linethickness' => array()),
'mn' => array(),
'mstyle' => array(
'scriptlevel' => array(),
'fontstyle' => array(),
'fontweight' => array(),
'mathvariant' => array(),
'displaystyle' => array()),
'mtext' => array(),
'mspace' => array(
'width' => array(),
'height' => array(),
'depth' => array()),
'msqrt' => array(),
'mmultiscripts' => array(),
'mprescripts' => array(),
'none' => array(),
'mroot' => array(),
'mphantom' => array(),
'merror' => array(),
'mover' => array(),
'munder' => array(),
'munderover' => array(),
'maction' => array(
'actiontype' => array(),
'other' => array(),
'selection' => array()),
'mtable' => array(
'align' => array(),
'columnalign' => array(),
'rowalign' => array(),
'equalrows' => array(),
'equalcolumns' => array(),
'columnspacing' => array(),
'rowspacing' => array(),
'columnlines' => array(),
'rowlines' => array(),
'frame' => array()),
'mrow' => array(
'xlink:type' => array(),
'xlink:show' => array(),
'xlink:href' => array()),
'mtr' => array(
'rowalign' => array(),
'columnalign' => array()),
'mtd' => array(
'rowspan' => array(),
'columnspan' => array(),
'rowalign' => array(),
'columnalign' => array()),
'mpadded' => array('width' => array())
);
return $tags;
}`
If anyone’s interested, you can find install at http://www.thetelegraphic.com/bbpress/bbpress/ (for now, once it’s fully working it’ll go to a dedicated domain).
Published on April 28th, 2007 by dprice
I’d like to see LaTex support implemented (in a plugin I guess), so people can post LaTex comments (eg for physics/maths forums). How hard would this be to implement in BBpress?