How would i use $mybb->settings['bburl'] in a js file
#2
This user has been denied support. This user has been denied support.
If you right click view page source anywhere in MyBB you might notice how some bunch of variables are exported to JavaScript... by adding it as JavaScript code to the webpage.

<script type="text/javascript">
<!--
 lang.unknown_error = "An unknown error has occurred.";

 lang.select2_match = "One result is available, press enter to select it.";
 lang.select2_matches = "{1} results are available, use up and down arrow keys to navigate.";
 lang.select2_nomatches = "No matches found";
 lang.select2_inputtooshort_single = "Please enter one or more character";
 lang.select2_inputtooshort_plural = "Please enter {1} or more characters";
 lang.select2_inputtoolong_single = "Please delete one character";
 lang.select2_inputtoolong_plural = "Please delete {1} characters";
 lang.select2_selectiontoobig_single = "You can only select one item";
 lang.select2_selectiontoobig_plural = "You can only select {1} items";
 lang.select2_loadmore = "Loading more results…";
 lang.select2_searching = "Searching…";

 var cookieDomain = "community.mybb.com";
 var cookiePath = "/";
 var cookiePrefix = "";
 var deleteevent_confirm = "Are you sure you want to delete this event?";
 var removeattach_confirm = "Are you sure you want to remove the selected attachment from this post?";
 var loading_text = 'Loading. <br />Please Wait..';
 var saving_changes = 'Saving changes..';
 var use_xmlhttprequest = "1";
 var my_post_key = "45dd85d7i2p31s500h669hi49767t2t1";
 var rootpath = "https://community.mybb.com";
 var imagepath = "https://community.mybb.com/images";
   var yes_confirm = "Yes";
 var no_confirm = "No";
 var MyBBEditor = null;
 var spinner_image = "https://community.mybb.com/images/spinner.gif";
 var spinner = "<img src='" + spinner_image +"' alt='' />";
 var modal_zindex = 9999;
// -->
</script>
<!-- end: headerinclude -->
<script type="text/javascript">
<!--
 var quickdelete_confirm = "Are you sure you want to delete this post?";
 var quickrestore_confirm = "Are you sure you want to restore this post?";
 var allowEditReason = "1";
 lang.save_changes = "Save Changes";
 lang.cancel_edit = "Cancel Edit";
 lang.quick_edit_update_error = "There was an error editing your reply:";
 lang.quick_reply_post_error = "There was an error posting your reply:";
 lang.quick_delete_error = "There was an error deleting your reply:";
 lang.quick_delete_success = "The post was deleted successfully.";
 lang.quick_delete_thread_success = "The thread was deleted successfully.";
 lang.quick_restore_error = "There was an error restoring your reply:";
 lang.quick_restore_success = "The post was restored successfully.";
 lang.editreason = "Edit Reason";
// -->

There is no bburl but maybe rootpath is the same. If you need something else just do it the same way, generate javascript code that sets the variable you like.

As for your add hook, you should look at some example... you need a hook name, and function name that should be called, not a description or whatever it is you have in there...

From the looks of things you still have a long way to go - good luck.
Reply


Messages In This Thread
RE: How would i use $mybb->settings['bburl'] in a js file - by frostschutz - 2016-09-28, 08:36 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)