include tinymce only if a user is logged into the site

For google page speed i had an issue when every page was loading tinymce, which is quite a large script.

I only actually use this script when editing pages, so this is the change i made to only insert it into the template if a user is logged into the site. 

This was related to : Google Page Speed Cleanup and Testing


// global.php
$tiny_mce_js = "";
if(isset($_SESSION["global_login"])) {
  $tiny_mce_js = '<script src="" integrity="sha256-rjy8f5xTyKOb6CxACEd6Vc99uhhjTKuqmTMrZ7TbdOA=" crossorigin="anonymous"></script>';

/* index.html (template) */
replace the script with 
[ @ tiny_mce_js]

Other Items in php
Related Search Terms
Page Views

This page has been viewed 95 times.

Search Code
Search Code by entering your search text above.

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.


Random Quote
Even if you fall on your face, you're still moving forward.
Victor Kiam