Marbl in PD9Soft MegaBBS 2.2

Installation

Extract the contents of the zip into a suitable location. For this guide we will use

/forums/plugins/marbl-amazon

After extraction you will have the following file system structure on the server:

  • /forums/plugins/marbl-amazon/css
  • /forums/plugins/marbl-amazon/images
  • /forums/plugins/marbl-amazon/js
  • /forums/plugins/marbl-amazon/readme.txt

In a HTML editor or your preferred text editor, open your forum template file at

/forums/templates/<template name>/fragments/template-begin.asp

You will see a series of CSS and JavaScript code block declairations wrapped in Response.Write. After the last </script> or </style> block add

Response.Write "<script type='text/javascript' src='/forums/plugins/marbl-amazon/js/MarblAmazonLink.class.js'></script>" & CRLF
Response.Write "<link rel='stylesheet' href='/forums/plugins/marbl-amazon/css/main.css' type='text/css' />" & CRLF

Note: If you intend to use your own CSS style sheet definitions, you do not need to include the main.css file.

Save and close the file.

Go to your MegaBBS forum Settings and Administration section. In the settings navigation select “Edit MBBS codes”.

Copy/paste the following into a text editor

<script type="text/javascript">
var marblAmazon = new MarblAmazonLink('/forums/plugins/marbl-amazon/');
    marblAmazon.addAssociateId('CA', 'hpcfactor0e-20');
    marblAmazon.addAssociateId('UK', 'hpcfactor-21');
    marblAmazon.addAssociateId('US', 'hpcfactor-20');
    marblAmazon.DisplayFlags=true;
    marblAmazon.OpenInNewWindow=true;
    marblAmazon.createCustomBuyLinks("ALL", "", "{param}", "", "", 16, false);
</script>

Edit the configuration as required, adding your own Affiliate link codes and other national programmes (MX, DE, FR, BR, AU etc.) by adding or removing marblAmazon.addAssociateId(‘<country code>’, ‘<your Affiliate Code>’); lines.

Now remove all line breaks from it so that the entire code block appears on a single line e.g.

<script type="text/javascript">var marblAmazon = new MarblAmazonLink('/forums/plugins/marbl-amazon/');marblAmazon.addAssociateId('CA', 'hpcfactor0e-20');marblAmazon.addAssociateId('UK', 'hpcfactor-21');marblAmazon.addAssociateId('US', 'hpcfactor-20');marblAmazon.DisplayFlags=true;marblAmazon.OpenInNewWindow=true; marblAmazon.createCustomBuyLinks("ALL", "", "{param}", "", "", 16, false);</script>

In the ‘Code’ textbox type:

[amazon={param}]

In the HTML text box copy/paste your edited script tag in, ensuring that there are no new-line characters present.

Leave the Closing tag (optional) and Closing HTML (optional) text boxes blank.

Click the submit button to add it to the MBBS Codes list.

Create a new test forum post and enter

[amazon=Fire TV]

Submit the post. You should now see displayed in-line within the body of the post.

Adding an Amazon link button to the Post Editor Toolbar

If you want to display an ‘Amazon Link’ Button on the of the post WYSIWYG editor, you must edit some additional files.

/forums/jscripts/post_toolbar/mbbs_code.js

Add the following near the bottom:

function tag_amazon() {
  var FoundErrors = '';
  var strFreetext = prompt('Enter Amazon product search phrase, ASIN or ISBN', "");

  if (!strFreetext) {
    FoundErrors += " " + 'You must provide a search term';
  }

  if (FoundErrors) {
    alert("Error!"+FoundErrors);
    return;
  }

  doInsert("[Amazon="+strFreetext+"]", "", false);
}

/forums/jscripts/post_toolbar/toolbar_settings.js

Add the following at the bottom:

var help_amazon = "Insert Sponsored Amazon Link (alt+ a)";

/forums/templates/<template name>/BBC/forum/thread-post.asp

Around half-way down the page, insert the button directly into the source code at your preferred location. Formal, position and style as required.

Response.Write "<input class='bbsbutton' onmouseover=""hstat('amazon')"" accesskey='a' onclick=""tag_amazon()"" type='button' value=' Amazon Link ' name='Amazon'>"

Upload the files to the server and refresh the post editor to see the changes.