By Example: CHtml

Comparing #5 with #6

Revision #6 was created by smarthead smarthead on Sep 29, 2009, 1:39:55 AM.

Add link()

Content

[...]
#### HTML Output:


```php
<a href="index.php?r=controller/action&param1=value1&param2=value2&param3=value3">Link Text</a>
```

 
   
 
_  
 
 
_  
 
 
 
## Chtml::button() method
 
~~~
 
public static string button(string $label='button', array $htmlOptions=array ( ))
 
~~~
 
Generates a button.
 
 
***
 
 
### Example 1: Connecting a button to a controller action
 
 
```php 
<?php echo CHtml::button('Button Text', array('submit' => 'controller/action')); ?>
 
```
 
 
#### HTML Output:
 
 
 
```php 
<input id="yt0" type="button" value="Button Text" name="yt0"/>
 
<script type="text/javascript">
 
/*<![CDATA[*/
 
jQuery(document).ready(function() {
 
jQuery('#yt0').click(function() {jQuery.yii.submitForm(this,'controller/action',{});return false;});
 
});
 
/*]]>*/
 
</script>
 
```