Alexander Firth
Active member
Some of my users want to install MathJax on our site for their maths courses etc, we have a homework/coursework help section. I got MathJax working successfully, but this added a full second to all page load times, so I dropped it. The users are still very much demanding it, and one of them wrote this for me:
Apparently this would only make the relevant files load in subforums with 'MathJax' in the forum URL something. I'm personally baffled. Would this work without wrecking page load times elsewhere, and if so where do I stick it?
I don't know PHP yet
PHP:
<?php
unset($out);
$out = "";
if(preg_match("#mathjax#",$_SERVER['REQUEST_URI'])){
$out = '<script type="text/javascript"src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>';
}
print $out
?>
Apparently this would only make the relevant files load in subforums with 'MathJax' in the forum URL something. I'm personally baffled. Would this work without wrecking page load times elsewhere, and if so where do I stick it?
I don't know PHP yet