![]() |
![]() |
|
|
|
Magic Button: Technical InformationBy: 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.
<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. |
|
quick links:
company
services
portfolio
|
Copyright © 1994-2008 RustyBrick, Inc. - Web Development |