MyBB Community Forums

Full Version: Trying to find where a Plugin added the JS Script.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ages ago I used to know where they were placed but now, completly forget.

I have a plugin that used:
$page = str_replace('<head>'

To place the JS into the forum. I want to remove this and place it into the footer where all my other Javascripts are.

Problem is I can't remember for the life of me what template the javascript got put into.

I've looked in:

Header Templates > header
Index Page Templates > index
Ungrouped Templates > headerinclude

But its not there.
I think it replaces the string after compiling the code and before showing in browser. It is not using any "preg_match" to replace the template code or inserting any variable. You need to change the plugin code if you want it available in template.

(I'm just assuming, lets see what other coding gurus say ...).
AdminCP > Templates > Footer Templates > footer <-- Is that what you mean?
(2012-11-27, 08:43 AM)Yaldaram Wrote: [ -> ]AdminCP > Templates > Footer Templates > footer <-- Is that what you mean?

I have plugins like mytabs, tapatalk etc. That use $page = str_replace('<head>' to place the javascript into the header of the forum.

But I can't find the template where the JS is placed, so I can remove it from the header and place it into the footer.
Tapatalk plugin is str_replacing the </head> tag. See line#83 of its plugin file. Its not inserted to any template.
$page = str_ireplace("</head>", "<script type='text/javascript' src='{$mybb->settings['bburl']}/mobiquo/tapatalkdetect.js'></script></head>", $page);

And MyTabs plugin is using this code to "join" $headerinclude variable with plugin's .js file. See line#154 of its plugin file;
$headerinclude .= "<script type=\"text/javascript\" src=\"{$mybb->settings['bburl']}/jscripts/mytabs.js\"></script>";

So you've to comment out those parts and paste the .js code into your theme's footer template. But I've not tested so I'm not sure it works.