Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How to get the domain name for addon ? How to add string add footer ?

saturngodsaturngod New
edited October 2011 in Vanilla 2.0 - 2.8
I am writing plugin and I need to add domain name for plugin path in javascript file.

<script> keyboards = [ ["http://www.saturngod.net/wp-content/plugins/jkeymagic/js/kb/Myanmar3.js", "Myanmar3"], ["http://www.saturngod.net/wp-content/plugins/jkeymagic/js/kb/Zawgyi L - Unicode.js", "Zawgyi L - Unicode"] ]; </script>

I want to add this string before .

I didn't find get domain name in vanilla 2 add on and add string before

Best Answer

  • lucluc ✭✭
    Answer ✓
    grep -i domain library/core/*

    You might found a function/method that does what you want.

Answers

  • lucluc ✭✭
    The links above are wordpress ones and they already have the domain name.

    You want add the domainname where?
  • @luc, sorry, I can't edit my question.

    I want to add

    http://www.mydomain.com/plugins/jkeymagic/js/kb/Myanmar3.js

  • lucluc ✭✭
    You don't need to add the full domain name.

    You just need to use: $Sender->AddJsFile('Myanmar3.js', 'plugins/jkeymagic/js/kb');
    or use the full path $Sender->AddJsFile('plugins/jkeymagic/js/kb/Myanmar3.js');
  • saturngodsaturngod New
    edited October 2011
    I need to add this in between <script> and </script>

    because it's dynamic loading from other script.
  • lucluc ✭✭
    Answer ✓
    grep -i domain library/core/*

    You might found a function/method that does what you want.
  • Thank. Now, I got it.

    $webroot=Gdn_Url::WebRoot();
    if($webroot!="") {
    $webroot=$webroot."/";
    }

    $domain=Gdn_Url::Domain();

    $address=$domain."/".$webroot;
Sign In or Register to comment.