RB Logo search_engine_optimization

seo tools • seo resources • iphone apps • client center

company
services
portfolio
web tools
client center
contact
home


phone: 877-GO-RUSTY
phone: 845-369-6869
email: info@rustybrick.com
print this page print this page

BBB Online


Magic Button: Technical Information

By: Jaimie Sirovich at RustyBrick, Inc.

This page gives a brief summary of how to install the Magic Button code onto your site.

Include the following code in your PHP script:

require_once('MagicButton.php');

Referenced Files: MagicButton.php

Place the following code in your header to execute the javascript. This sets up the Magic Button, tells it to replace any anchors in the class "foo" with the script "magic_button.php?font_color=000000, and then executes the code necessary to do so.

Obviously, we must also change the paths to reflect where we placed the files.

<script language="JavaScript" src="get_element_by_selector.js"></script>
<script language="JavaScript" src="replacement.js"></script>

<script language="javascript">
<!--

MB_construct("/pics/spacer.gif", 1000);
MB_addReplacement("a.foo", "magic_button.php?font_color=000000&offset_top=-1&font_size=9&padding=10");
MB_execute();

// -->
</script>

Referenced Files: get_element_by_selector.js, replacement.js, magic_button.php (referenced by javascript up above), pseudo.css.php (referenced in replacement.js), default.ttf (our font file referenced by magic_button.php)

Below, you'll find an actual directory of a button template. You'll want to create a directory called magic_button_templates/1/ as well. It's referenced from your magic_button.php file.

The button template: magic_button_templates/1/

  !   spacer.gif can be any small image in your collection of images, but it must be there, otherwise the script will never execute.

Then we proceed to put a tag like so into our page:

<a href='http://www.tacobell.com' class=foo>Really Annoying Dog</a>

The result is:
Really Annoying Dog

I will be adding more comments to the code to explain how it works. The code is relatively clear. If you have questions in the meantime, I can be reached at jsirovic --at-- rustybrick.com.