Icontem

simTaco: Update Web pages in parts via AJAX like Facebook

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2012-02-08 (4 years ago) RSS 2.0 feedNot enough user ratingsTotal: 458 All time: 60 This week: 21Up
Version Licenses JavaScript version Categories
simtaco 1.0GNU General Publi...1.0AJAX, XML
Description Author

This object is a jQuery plugin that can update Web pages in parts via AJAX like Facebook.

It can perform AJAX requests to the Web server which should return a XML with commands that can execute updates of parts of the current page.

The page elements that should updated are defined as CSS selectors with a syntax supported by jQuery.

Picture of Hensel Hartmann
Name: Hensel Hartmann <contact>
Classes: 5 packages by
Country: Switzerland Switzerland
Age: 44
All time rank: 171 in Switzerland Switzerland
Week rank: 45 Down2 in Switzerland Switzerland Down

Details
/*
+--------------------------------------------------------------------------
|   jQuery simTaco plugin - A port of jQuery Taconite plugin by M. Alsup
|   http://malsup.com/jquery/taconite/
|   
|   There are two important differences!
|   1. simTaco can send unlimited options to the server - must be defined as JSON
|   2. simTaco works onDemand (bind) and not by listener - that caused issues with other scripts in my work
|   
|   Additionally and most important, simTaco works with latest jQuery - tested up to v1.7.1
|   
|   simTaco allowes the fast developpment of extended user interfaces, like for example the one from Facebook.
|   Multiple DOM updates, content changes and style changes can be 
|   performed by a single AJAX call. This call can transmit as many variables as needed!
|   The server responds with an XML file, that holds all changes intended.
|   
|   ========================================
|   simTaco Copyright (c) 2012 by Hensel Hartmann
|   http://www.simpeligent.ch
|   ========================================
|   simTaco is Dual licensed under the MIT and GPL licenses:
|   http://www.opensource.org/licenses/mit-license.php
|   http://www.gnu.org/licenses/gpl.html
|    
+--------------------------------------------------------------------------
*/

**********************************
HTML to call a simTaco xml:
**********************************

    <span class="someElement" simTaco_path="simTaco_controller.php" simTaco_options='{"page":"main","id":"1","foo":"bar","anyOption":"you like"}' >simTaco-Link</span>

simTaco_path is optional - it can aswell be defined centralized for all elements (see below)
simTaco_options must be valid JSON - it can be as long as you like and can also be defined elsewhere (see below)
**********************************


**********************************
Simple JS to call all simTaco xml:
**********************************
simTaco does use cachebusting code - each call is a fresh one.

    <script>
    $('.someElement').live('click', function() {
        var element = this;
        var p = jQuery(element).attr('simTaco_path');
        if(!p){ p = 'simTaco_controller_default.php';}
        var s = jQuery(element).attr('simTaco_options');
        $().simTaco({
          'simTacoDebug' : 1,   // set to one to get debug info in Firebug
          'path' : p,           // the server side file, that responds with valid XML 
          'options' : s         // options as JSON   
        });
    });
    </script> 
**********************************


**********************************
Some examples:
**********************************
you can find more on the taconite site
http://malsup.com/jquery/taconite/


    <!-- no-arg commands --> 
    <remove select="#result2" /> 
    <hide select="#result" /> 
    
    
    <!-- one-arg command --> 
    <addClass select="#result" arg1="special" /> 
    <slideUp select="#result" arg1="slow" />
    <slideDown select="#result" arg1="slow" />
    
    <!-- two-arg command --> 
    <attr select="#result" arg1="title" arg2="My Title" /> 
    <css select="div" arg1="width" arg2="500px" />
    
    
    One Special Command: |eval|
        <eval> 
            $('#result').html("This text came from an eval command!"); 
        </eval> 
    Note: The JavaScript should be inside a CDATA block if it contains
    special characters like |<| or |&|.
        <eval> 
            <![CDATA[ 
                $('#result').html("<strong>An error has occurred!</strong>"); 
            ]]> 
        </eval> 
    
    
    <after select="#result"> 
        This text will go AFTER the result div. 
    </after> 
    
    <before select="#result"> 
        <div>This div will go BEFORE the result div.</div> 
    </before> 
    
    <wrap select="#result span"> 
        <span style="border: 1px dashed #00F"></span> 
    </wrap> 
    
    <append select="#result"> 
        <div>This div is APPENDED</div> 
    </append> 
**********************************
  Files folder image Files  
File Role Description
Plain text file jquery.simtaco.1.0.js Class simTaco plugin main file
Plain text file readme.txt Data some more info
Plain text file simTaco_controller.php Data dynamic xml to use in the usage demo
Plain text file UsageDemo.php Example Demo of basic usage

 Version Control Unique User Downloads Download Rankings  
 0%
Total:458
This week:0
All time:60
This week:21Up