[BETA] MathJax phpBB Integration

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Suggested Hosts
Kleineganz
Registered User
Posts: 27
Joined: Sat Feb 23, 2013 3:53 am

Re: [ALPHA] MathJax phpBB Integration

Post by Kleineganz »

muggins wrote:I'm going to install this on my test board. Maybe I can help afterwards...

Edit: Man, the base MathJax package is as big as a regular LaTeX distro! :shock:

Stay tuned. :|
Yeah it's huge. Took me forever to get it uploaded to my server yesterday.
sergio91pt
Registered User
Posts: 62
Joined: Thu Jul 07, 2011 11:03 am

Re: [ALPHA] MathJax phpBB Integration

Post by sergio91pt »

Kleineganz wrote:
sergio91pt wrote:Looks good. Try to clear the cache and reload.
I already tried that, and I just cleared the cache again, no luck. :/
The problem is that S_ENABLE_MATHJAX seems to be false. It is set to true when the mod is enabled and dynamic loading is disabled or the page has a bbcode with is_math=1 (from bbcodes table).

You mentioned that you re-installed the mod which normally removes the math bbcodes. Can you make another test post?

I know I have to update UMIL, ModX files and test with 3.0.11, I'll do that when I have some free time.
muggins wrote:I'm going to install this on my test board. Maybe I can help afterwards...

Edit: Man, the base MathJax package is as big as a regular LaTeX distro! :shock:

Stay tuned. :|
Thanks for helping out.
User avatar
muggins
Registered User
Posts: 1183
Joined: Fri Feb 22, 2008 5:12 pm
Location: Texas
Name: Donovan
Contact:

Re: [ALPHA] MathJax phpBB Integration

Post by muggins »

OK. I'm on the verge of giving up.

I'm not a noob, nor am I stupid. The instructions for this are crappy. I installed a local copy under my web root as mathjax. Tried and failed. Copied the the directory to the forum root and reinstalled with no errors.

Configured the mod per instructions and all I get is [math] as the output. The local copy does indeed work; I tested it before taking all this time to test.

Maybe your install instructions need a rework, or this thing is just a turd. LaTeX works just fine for my main site.

Could you give a detailed description of where you put the files and how you specify the options for the bbCode? Otherwise I'll just stick with what works for me, and everyone else can help themselves.
Muggins
Kleineganz
Registered User
Posts: 27
Joined: Sat Feb 23, 2013 3:53 am

Re: [ALPHA] MathJax phpBB Integration

Post by Kleineganz »

sergio91pt wrote:
Kleineganz wrote:
sergio91pt wrote:Looks good. Try to clear the cache and reload.
I already tried that, and I just cleared the cache again, no luck. :/
The problem is that S_ENABLE_MATHJAX seems to be false. It is set to true when the mod is enabled and dynamic loading is disabled or the page has a bbcode with is_math=1 (from bbcodes table).

You mentioned that you re-installed the mod which normally removes the math bbcodes. Can you make another test post?
Here is a new test post:
http://geek-central.net/viewtopic.php?f=5&t=54077

Thanks! :)
User avatar
muggins
Registered User
Posts: 1183
Joined: Fri Feb 22, 2008 5:12 pm
Location: Texas
Name: Donovan
Contact:

Re: [ALPHA] MathJax phpBB Integration

Post by muggins »

I apologize for my snippy tone previously. I needed dinner.

Check the permissions on all the folders in the mathjax download. On my system they were all 700 instead of 755. That might make a world of difference, since they couldn't be accessed. Check the directories inside the subfolders as well.

I'll try again tomorrow. :oops:

Since I can't seem to post image links right now, try the mathjax test page at my standalone installation of the base package.

Edit: I'll remove that instance tomorrow when I wake. In the meantime, please enjoy! :D
Muggins
Kleineganz
Registered User
Posts: 27
Joined: Sat Feb 23, 2013 3:53 am

Re: [ALPHA] MathJax phpBB Integration

Post by Kleineganz »

Alright, I did a CHMOD 755 on all files and subdirectories under the /mathjax directory on my forum server. I also cleared out the cache and tried a new test:

http://geek-central.net/viewtopic.php?f=5&t=54078

Still nothing. :|
User avatar
muggins
Registered User
Posts: 1183
Joined: Fri Feb 22, 2008 5:12 pm
Location: Texas
Name: Donovan
Contact:

Re: [ALPHA] MathJax phpBB Integration

Post by muggins »

This one is ticking me off. I'll make it work and publish a good tutorial on getting it set up. It shouldn't be so kludgy..

Give me a day or two. :|

Files should be 644, btw. Directories are 755.
Muggins
Kleineganz
Registered User
Posts: 27
Joined: Sat Feb 23, 2013 3:53 am

Re: [ALPHA] MathJax phpBB Integration

Post by Kleineganz »

muggins wrote:This one is ticking me off. I'll make it work and publish a good tutorial on getting it set up. It shouldn't be so kludgy..

Give me a day or two. :|

Files should be 644, btw. Directories are 755.
Ok thanks. I switched the files to 644 and kept the directories as 755.
sergio91pt
Registered User
Posts: 62
Joined: Thu Jul 07, 2011 11:03 am

Re: [ALPHA] MathJax phpBB Integration

Post by sergio91pt »

I'm unable to replicate the issue:
I just did a clean install with phpBB 3.0.11, automod 1.0.2, MathJax 2.1 (local copy, no CDN), we_universal 2.2.0, on an up-to-date Ubuntu 12.04 machine, with php 5.3.10, mysql 5.5.29 and lighttpd 1.4.28.

Image
Image

Permissions can indeed be a real pain, I installed everything using sudo su www-data -c bash, but as I said before Kleineganz problem is mathjax.html not being included, when theres a math bbcode to process.

Kleineganz, can you post your includes/bbcode.php? pastebin is fine. In the meantime you can disable dynamic loading in .Mods->Mathjax->General Settings, it should work.
Last edited by sergio91pt on Fri Mar 01, 2013 11:22 am, edited 3 times in total.
sergio91pt
Registered User
Posts: 62
Joined: Thu Jul 07, 2011 11:03 am

Re: [ALPHA] MathJax phpBB Integration

Post by sergio91pt »

muggins wrote:OK. I'm on the verge of giving up.

I'm not a noob, nor am I stupid. The instructions for this are crappy. I installed a local copy under my web root as mathjax. Tried and failed. Copied the the directory to the forum root and reinstalled with no errors.

Configured the mod per instructions and all I get is [math] as the output. The local copy does indeed work; I tested it before taking all this time to test.

Maybe your install instructions need a rework, or this thing is just a turd. LaTeX works just fine for my main site.

Could you give a detailed description of where you put the files and how you specify the options for the bbCode? Otherwise I'll just stick with what works for me, and everyone else can help themselves.
The mathjax folder can be put anywhere in your site, but the path must be relative to your forum root path. For example if you place the files in mysite.com/mathjax and phpbb is at mysite.com/forum/ then the path to enter in ACP is ../mathjax.

Right now validation is simply done by checking if a file named MathJax.js exists inside the folder:

Code: Select all

file_exists($phpbb_root_path . $path . '/MathJax.js')
Clearly I have to add permission checks for the next version.

If you want to use URL's, its relatively easy by overriding the CDN URL's. They're stored in the database. Have a look with:

Code: Select all

SELECT *
FROM `phpbb_config`
WHERE `config_name` LIKE 'mathjax_%'
The bbcodes are normal bbcodes that you could create by hand, in Posting->Messages->BBCodes, with the exception that theres a column added to phpbb_bbcodes table, called 'is_math'. That column defaults to 0 and should be set to 1 for a math bbcode. Have a look at the generated bbcodes, they're not hidden by default (theres an optional mod to do that). The ones installed by default are: [latex] for LaTeX code, [math] for MathML (XML) code.

When posts are being parsed for display, valid bbcodes are matched against phpbb_bbcodes. If the mod is enabled and one of the bbcodes have is_math=1 then S_ENABLED_MATHJAX is set to true.

If you see [math] on the post (the preview text), then the bbcode was correctly detected as a normal bbcode and the template applied but only if $rowset[$bbcode_id]['is_math'] evaluate to true that the template variable S_ENABLED_MATHJAX is set to true in this stage.

If dynamic loading is set to false and the mod is enabled then S_ENABLED_MATHJAX is always set to true, when pages are loaded.

What I just described can easly be followed by reading the modifications to core files in install_mod.xml.
Kleineganz
Registered User
Posts: 27
Joined: Sat Feb 23, 2013 3:53 am

Re: [ALPHA] MathJax phpBB Integration

Post by Kleineganz »

sergio91pt wrote:I'm unable to replicate the issue:
I just did a clean install with phpBB 3.0.11, automod 1.0.2, MathJax 2.1 (local copy, no CDN), we_universal 2.2.0, on an up-to-date Ubuntu 12.04 machine, with php 5.3.10, mysql 5.5.29 and lighttpd 1.4.28.

Image
Image

Permissions can indeed be a real pain, I installed everything using sudo su www-data -c bash, but as I said before Kleineganz problem is mathjax.html not being included, when theres a math bbcode to process.

Kleineganz, can you post your includes/bbcode.php? pastebin is fine. In the meantime you can disable dynamic loading in .Mods->Mathjax->General Settings, it should work.
Unfortunately disabling dynamic loading my my .Mods didn't work either. Here is my pastebin of the bbcode.php:

http://pastebin.com/ZUtMRHdP
Kleineganz
Registered User
Posts: 27
Joined: Sat Feb 23, 2013 3:53 am

Re: [ALPHA] MathJax phpBB Integration

Post by Kleineganz »

sergio91pt wrote:The bbcodes are normal bbcodes that you could create by hand, in Posting->Messages->BBCodes, with the exception that theres a column added to phpbb_bbcodes table, called 'is_math'. That column defaults to 0 and should be set to 1 for a math bbcode. Have a look at the generated bbcodes, they're not hidden by default (theres an optional mod to do that). The ones installed by default are: [latex] for LaTeX code, [math] for MathML (XML) code.
Interesting, if [latex] is for LaTeX code, then my tests should be showing:

[latex]
[math]

and not

[math]
[math]

Perhaps I'm using the wrong notation for LaTeX, or it's a further clue as to what's wrong with my installation?

Image
Kleineganz
Registered User
Posts: 27
Joined: Sat Feb 23, 2013 3:53 am

Re: [ALPHA] MathJax phpBB Integration

Post by Kleineganz »

sergio91pt wrote: Image
I just noticed you also get the UMIL warning after your installation. Did you update the UMIL after installing the MathJax mod? I actually went ahead and did that. Could the fact that I updated my UMIL be causing issues with the mod?
sergio91pt
Registered User
Posts: 62
Joined: Thu Jul 07, 2011 11:03 am

Re: [ALPHA] MathJax phpBB Integration

Post by sergio91pt »

Kleineganz wrote: Unfortunately disabling dynamic loading my my .Mods didn't work either. Here is my pastebin of the bbcode.php:

http://pastebin.com/ZUtMRHdP
Is the mod installed and did modifications to core files apply correctly? I'm asking because your bbcode.php doesn't have this mod modifications. Can you open install_mod.xml in a browser and patch includes/bbcode.php and includes/functions.php manually?
It shouldn't take long. Don't forget to clear the cache afterwards.
Kleineganz wrote:
sergio91pt wrote:The bbcodes are normal bbcodes that you could create by hand, in Posting->Messages->BBCodes, with the exception that theres a column added to phpbb_bbcodes table, called 'is_math'. That column defaults to 0 and should be set to 1 for a math bbcode. Have a look at the generated bbcodes, they're not hidden by default (theres an optional mod to do that). The ones installed by default are: [latex] for LaTeX code, [math] for MathML (XML) code.
Interesting, if [latex] is for LaTeX code, then my tests should be showing:

[latex]
[math]

and not

[math]
[math]

Perhaps I'm using the wrong notation for LaTeX, or it's a further clue as to what's wrong with my installation?

Image
[math] is the default preview text for both bbcodes. The priview text is like a placeholder that shows while MathJax is loading. You can check them in .Mods->Mathjax->BBcode Settings
Kleineganz wrote:
sergio91pt wrote: Image
I just noticed you also get the UMIL warning after your installation. Did you update the UMIL after installing the MathJax mod? I actually went ahead and did that. Could the fact that I updated my UMIL be causing issues with the mod?
Nope. If you update afterwards then theres no problem, its just used for the install (its bundled with the mod). Start by patching the files. If it still doesn't work, you can copy over the umil folder and install.php and re-install.
Kleineganz
Registered User
Posts: 27
Joined: Sat Feb 23, 2013 3:53 am

Re: [ALPHA] MathJax phpBB Integration

Post by Kleineganz »

sergio91pt wrote:
Kleineganz wrote: Unfortunately disabling dynamic loading my my .Mods didn't work either. Here is my pastebin of the bbcode.php:

http://pastebin.com/ZUtMRHdP
Is the mod installed and did modifications to core files apply correctly? I'm asking because your bbcode.php doesn't have this mod modifications. Can you open install_mod.xml in a browser and patch includes/bbcode.php and includes/functions.php manually?
It shouldn't take long. Don't forget to clear the cache afterwards.
Alright this is starting to get beyond my capabilities. First opening the install_mod.xml in a browser didn't work, but I just opened it in an editor instead.

(This is what I see in Chrome - FYI, I'm on a Windows machine):

Image

I saw the modifications but when I attempt to do them, my editor keeps giving me syntax errors, so clearly I'm doing something wrong (and therefore I haven't pushed the changes live).

I can tweak existing PHP, but I can't write it from scratch - so when I run into syntax errors, I have no idea how to fix them. You're right though, the mod codes are missing from those 2 files.
Locked

Return to “[3.0.x] MODs in Development”