Sign Up! Login: Password: New User? Forgot? Support
Top Mods!
Wowhead Search
by sonofsamedi
Digital Clock
by Wolfar15
Admin Forums
Welcome to the GuildPortal Help Community! These forums are for admin-to-admin help.
Available Forums
Forums : Voodoo Tech and Scripter's Den of Scriptniquity > Add Ni Karma Data to your site
Mottie (MVP) 8/9/2010 7:32 PM EST : Add Ni Karma Data to your site
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Add Ni Karma Data to your site

The Ni Karma addon for WoW provides a php file to display the data on your site, but none of the hosting sites (that I know of) will allow you to add your own php file. So by request of Blooddog, GM of Bane of Existence, I put together this method of showing the data. And thanks Blooddog for letting me use your data in the demo and examples below.



Setup
  • Overall Information
    I'm going to do this one a little different. I'll have you download the files, modify then upload them to your site. Once everything is in place, all you'll need to do is upload your latest "Ni_Karma.lua" file from your "World of Warcraft/WTF/Account/{account name}/SavedVariables" folder.
  • Database location
    If you are already using the addon, hopefully you already know where your information is stored in the database. I can't help you here because I've never used the addon, but in the demo the important data is stored in the "Test > ICC > ICC25" database. If you don't know where your data is located, then you'll have to open your Ni_Karma.lua file from teh SavedVariables folder and examine the tree structure - if you look in the demo lua file you'll notice that the second line has the name "Test". If the next line (two tabs in) contains a character name, then it might contains the data you need, if not, scroll down the file until you find the next section that has data that isn't a character name. If you have a hard time finding the correct database, send me a copy of your lua and I'll try to help.
  • Download the files
    Download and extract the necessary files from the zip file.
    If you don't have a way to do this, then grab my demo files (right click and save): Ni_Karma.htm, Ni_Karma-dark.css & Ni_Karma-light.css.

  • Change the settings
     // Ni_Karma.lua file name/location: Use filename only if that file is in the same directory as this htm
     // if not, use the full path (e.g. http://www.axiomfiles.com/Files/######/Ni_Karma.txt)

     var NKFileName = "Ni_Karma.lua";

     // Ni Karma Database location
     var database = "Test.ICC.ICC25";

     // show the last # entries in the tooltip
     var TooltipShowsLast = 5;

     // popup window size
     var popupWidth = 500;
     var popupHeight = 450;
    1. Open the "Ni_Karma.htm" file in a text editor (not a rich text type editor)
    2. Modify the "NKFileName" variable (Ni Karma file name in orange) as necessary. You'll only need to change this if you have more than one GuildPortal site and put the "Ni_Karma.htm" file on one site and the "Ni_Karma.lua" file on another. This script will not work cross domain, or in other words, the url of both files must be in the same domain (e.g. http://www.axiomfiles.com/).
    3. Modify the database location in orange. As described before, you'll need to know or find the database location for your setup. Follow the format above by separating each database branch with a period. Once you have these files uploaded and incorrect database is targeted, you won't see the correct information or you'll see a "No Data Found!" message.
    4. The tooltips are designed to only show the last few entries in the Ni Karma database for the character you are hovering over. You can set how many of the last entries to show by adjusting the value of "TooltipShowsLast" in red.
    5. When you click on a Ni Karma value, a popup window will open which contains all the database entries for that character. You can adjust the size by modifying the "popupWidth" and "popupHeight" variables in red.
  • Styling the page
    Choose from either of the two CSS files I've provided in the zip. The "Ni_Karma-dark.css" or "Ni_Karma-light.css". Or, load either of these files into a text editor and modify the colors to match your site. I tried to comment all of the CSS so hopefully it isn't too confusing. The only images in the CSS are for the table sort arrows. By default, both css files use the white arrows, but if you want to use the black arrows for a lighter header background, you can get them here: sort ascending & descending. Once you have your css file selected, change the link href (in orange) in the "Ni_Karma.htm" file (near the top of the page):
    <!-- Choose from Ni_Karma-dark.css, Ni_Karma-light.css or make your own -->
    <link rel="stylesheet" href="Ni_Karma-dark.css" type="text/css" />
    *Note: The popup window gets its styling from this same link, so if you want to change the popup window styling you just need to modify the same css file.

  • Uploading
    Upload your selected css file, Ni_Karma.htm and Ni_Karma.lua files through your GuildPortal File Manager (Control Panel > General Settings & Tools > File Manager). Now get and save the URL to the Ni_Karma.htm file, it'll look something like this: http://www.axiomfiles.com/Files/######/Ni_Karma.htm. It might even be a good idea to open the page to make sure it is all working properly, if not check the Troubleshooting section below.
  • Setup your site
    To make this page display on your site, you're going to have to add it to an iframe. You can either use an "Embedded page" type widget or a "Free Form Text/HTML" type widget (Control Panel > Pages & Content > Current Pages: {Pick a page} > Add Widget tab). Add the widget to the center of the page.

    1. Embedded Page:
      When you click edit inside the widget a new window will open and ask for the page URL (which you should have saved) and the height of the frame. Choose something like 800 (pixels) or whatever height best fits your data without needing to scroll the frame.

    2. Free Form Text/HTML:
      If you decided to use a free form widget to add the following iframe code, make sure the editor is in HTML mode:

      <iframe width="620" height="800" src="http://www.axiomfiles.com/Files/######/Ni_Karma.htm" scrolling="auto" frameborder="0" align="top" allowtransparency="true"></iframe>

      Adjust the width and height (in red) as needed.
      Change the file url in orange to point to your newly uploaded Ni_Karma.htm file.
  • Troubleshooting

    • No Data Showing:
      1. Check that your "NKFileName" is pointing to the lua file. If they are both in the same file area, then you don't need a full url, just use the file name.
      2. Verify that your "NK_Karma.lua" is the correct one. If you click on the link in the file manager, it may make you download the file. Open it in your text editor and make sure the file starts with "KarmaList = {". If not, you have the wrong file.
      3. Make sure you are targeting the correct database in the lua file (in the "database" variable in the "Ni_Karma.htm" file). As I stated before, I haven't use the addon, so I don't know if it is easy to get this database location, but if you are having trouble, it might be best to just shoot me a copy of your file and I'll figure it out for you.
      4. If you know your database location, make sure the "database" variable points to it, but separate each folder with a period (e.g. the database located in Test > ICC > ICC25 should be targeted like this: "Test.ICC.ICC25".

    • Incorrect Data Showing:
      1. You may have the incorrect database targeted inside of the "Ni_Karma.lua" file. Try looking for a sub-database. You could put all of the files on your desktop with a copy of the latest lua on the desktop as well, then change the "database" variable target to test the data. If you use the demo lua file, try changing the database variable to "Test" or "Test.ICC" and see the results.
      2. If you are still stuck, shoot me a copy of your lua and I'll find the correct location for you (if I can).

    • No Style:
      1. Check the link href near the top of the "Ni_Karma.htm" file. It should point to either "Ni_Karma-dark.css" or "Ni_Karma-light.css" or your custom css file if you set one up. The full url is not necessary if the htm and the css files are in the same file area.
      2. Make sure the css file exists in your file area. Click on the link to the file and see if the css file opens in the browser. If not, try uploading the file again.
Updating
This is really the easiest part  shocked
  1. Open up your GP File Manager (Control Panel > General Settings & Tools > File Manager).
  2. Click the [Upload File(s)] button.
  3. Click [Select].
  4. Now find the latest copy of your "Ni_Karma.lua" in your WoW SavedVariables folder (World of Warcraft/WTF/Account/{account name}/SavedVariables), then click [Open]
  5. Click [Upload].
  6. Reload the page on your site with your Ni Karma data 
Edit (8/14/2010): Updated Ni_Karma.htm to eliminate a potential security issue.
TopBottom

BaneOfExistenceGM (New Admin) 8/11/2010 8:06 PM EST : RE: Add Ni Karma Data to your site

BaneOfExistenceGM
Posts: 43
Becoming Adept!

Thanks Mottie, and if you or anyone else needs help, don't be shy.
TopBottom

Starjammer (New Admin) 4/16/2011 4:53 AM EST : RE: Add Ni Karma Data to your site

Starjammer
Posts: 6
Getting Started!

admin post slashed at author request
TopBottom

Mottie (MVP) 4/16/2011 5:50 PM EST : RE: Add Ni Karma Data to your site
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Hi Starjammer!

Can you email me a clean copy of that lua file to wowmotty at gmail  dot com... and please! remove it from the post above!
TopBottom

Starjammer (New Admin) 4/17/2011 12:40 AM EST : RE: Add Ni Karma Data to your site

Starjammer
Posts: 6
Getting Started!

thx for the reply, sending clean file.. also atempted take the included demo and edit it and add my guilds char and data to it and can get the data to show but cannot it to work ingame after editing, apparently there seems to be an update to the ni karma database that is incompatable with current version you provide.

i do not have permissions to delete my own thread and trying to edit it gives me a scripting error due to length and a 404 error if edited , please feel free to delete it.
TopBottom

Starjammer (New Admin) 4/17/2011 3:08 PM EST : RE: Add Ni Karma Data to your site

Starjammer
Posts: 6
Getting Started!

did a line by line compairison , only changes i could find were in the karmaconfig plugin part at the end. the version had changed and a line ' [current_raid] = name ' was added
TopBottom

Admins Online
There are   members online.
So-and-so has logged on!
%title%
%message%