Scriptatype:PHP
Based on the Ruby on Rails plugin “Winn Scriptatype:Rails“ this php class works with Scriptalious and Prototype. This is an easy class to start using, just include the winnscriptatype class and the two javascript librarys. Then make the php call and your done!
Install
- Upload all the files to your server.
- Include the files listed below:
1 2 3 | include 'path/to/class/winnscriptatype.php'; // Make the call $w = new WinnScriptatype(); |
Now lets include the Javascript
1 2 | <script src="js/prototypejs.js" type="text/javascript"></script> <script src="js/scriptaculous.js" type="text/javascript"></script> |
Ok, lets test it out!
1 2 3 4 5 | <table> <tr style="background: #333333 none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: #ffffff" id="thisrow"> <td>$w->checkbox_do_fade('thisrow', 'mychkbox', 'sample_script.php', array('test' => '1')); ?> This is my test.</td> </tr> </table> |
All of the above code was taken from the sample.php file in the root of the scriptatype download. Lets learn how to make the correct formated calls to this class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | $w->checkbox_do_fade('*', '**', '***', array('userName' => 'Bob')); // * [Element ID] - This is the ID of the element you want the effect on. // ** [CheckBox ID] - This is the ID of the CheckBox. // *** [Script URL] - This is the url to the script that will execute when the user clicks the checkbox. // Array - Provide extra options for the script each option will act as a KEY = VALUE // In the example above userName = Bob // the URL would be /path/to/script.php?userName=Bob // = AVAILABLE CALLS checkbox_do_fade checkbox_do_puff checkbox_do_blindup checkbox_do_dropout // two effects checkbox_do_fade_and_appear checkbox_do_fade_and_puff checkbox_do_fade_and_blindup checkbox_do_fade_and_blinddown checkbox_do_fade_and_dropout checkbox_do_fade_and_highlight |
Ok, we’er all done! Now you can start using Winn Scriptatype in your next application or website!
Get this script: Download Winn Scriptatype:php v1.5 Stable
Want the latest? Visit our SourceForge project page for the nightly dump!