Difference between #5 and #6 of
By Example: CHtml

Revision #6 has been created by smarthead on Sep 29, 2009, 1:39:55 AM with the memo:

Add link()
« previous (#5) next (#7) »

Changes

Title unchanged

By Example: CHtml

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

Content changed

[...]
#### 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>
 
```
79 0
74 followers
Viewed: 993 834 times
Version: 1.1
Category: Tutorials
Written by: jonah
Last updated by: glicious
Created on: Sep 25, 2009
Last updated: 8 years ago
Update Article

Revisions

View all history