MyBB Community Forums

Full Version: JavaScript in Posts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've recently started using MyBB for work to get people to share knowledge etc and so far its ticking along. One of the things I've looked for for years though is a spreadsheet type page for progress sheets. I've stumbled across dhtmlx spreadsheet which I've got working in a stand alone sheet. From a webpage it's easy to call as its one line of JavaScript code.

There are plugin versions for the likes of Joomla, Drupal, ModX and Wordpress but none for MyBB. I'm presuming that getting Javascript into a post isn't possible (and I've seen might be a risk). Can anyone think of a way I can either get it into a post, or a page that is still authenticated with the same login?

Many thanks in advance.

PS I should add that the javascript seems to be calling a separate php file as it uses "script src=xxx".
link to the code? adding to a template is easy but that works for all users. a plugin would insert the code based on permissions or usergroup.

link to the script you are looking at?
The script itself is:

<script src="/var/www/flmd/ssheet/codebase/spreadsheet.php?sheet=3&key=key3&parent=box&math=true" ></script>

Are you looking for the spreadsheet.php file contents?
if it is the same code for all situations and you want to allow it for all users/groups then just paste that bit into the template where you want it to apply.
(2013-03-21, 11:53 PM)pavemen Wrote: [ -> ]if it is the same code for all situations and you want to allow it for all users/groups then just paste that bit into the template where you want it to apply.

Bear with me - I'm thick!

The script puts a spreadsheet on to a page. such as http://flm.no-ip.info/ssheet/test.html. I'd like to be able to get that into a post or into a page that I can have somewhere within the MyBB environment. If I stick the code in th header won't it just show the spreadsheet in the header?
what happens to the data inside the spreadsheet, or what do you want to happen with the data inside?

if the data storage is not an issue, just edit the newreply, newthread and editpost templates and insert the script where you want it to show up
(2013-03-22, 12:06 AM)pavemen Wrote: [ -> ]what happens to the data inside the spreadsheet, or what do you want to happen with the data inside?

if the data storage is not an issue, just edit the newreply, newthread and editpost templates and insert the script where you want it to show up

The data *should* take care of itself. I only need this in a handful of posts - although thinking about it it may well end with a problem of editing it in a post thats not yours I suspect.

If I was to create a new page with page manager would this do the trick? ANd can I use the code straight in the page itself?

Thanks for your help btw . Much appreciated Smile
you can do that and supply the code to validate against whatever usergroups you want to use it, etc. otherwise a plugin can be made that will selectively add the code based on some settings.
I'm not sure on how to get the script on the page. I've used page manager to create a new page but the result of the javascript won't show up.

Scrap that - ignore me. Partly an iffy script and partly I can't type. Many thanks for your help with it.