Skip to content

Commit

Permalink
Fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
pgaultier committed Feb 17, 2012
1 parent 096a7e6 commit d8501c7
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions readme.mkd
Expand Up @@ -37,11 +37,12 @@ Using the callback system you can :

Register an event in the widget using Sweeml

````php
<?php Sweeml::registerEvent('updateCart', "function(data){jQuery('#cart.nb').html(data+' products');}"); ?>
<div id="cart">0 product</div>

````
Whereever the cart is updated you can raise an event.

````
<script type="text/javascript">
function refreshCart() {
// perform ajax call to refresh info
Expand All @@ -55,12 +56,12 @@ Whereever the cart is updated you can raise an event.
}
</script>
<a href="#" onclick="refreshCart()">refresh cart</a>
````

### Multi file upload

The basic model

````
<?php
class MyFile extends CFormModel {
public $thefile;
Expand All @@ -72,9 +73,9 @@ The basic model
);
}
}

````
The controller

````
<?php
class UploadController extends CController {
/**
Expand Down Expand Up @@ -107,9 +108,9 @@ The controller
$this->render('index', array('file' => $file));
}
}

````
The view

````
<?php echo Sweeml::activeAsyncFileUpload($file, 'thefile',array(
'config' => array(
'runtimes' => 'html5, flash',
Expand All @@ -129,4 +130,4 @@ The view
)); ?>
<?php echo Sweeml::htmlButton('submit', array('type' => 'submit', 'id' => 'submitButton')); ?>

````

0 comments on commit d8501c7

Please sign in to comment.