A simple go back button widget

Comparing #1 with #2

Revision #2 was created by bennouna bennouna on Oct 4, 2012, 7:33:37 PM.

Some corrections related to Markdown syntax

Content

[...]
Why a widget ? Simple, we can extend the variables and make it as complex as we want, but will not be this case ;). We are going to pass just 1 variable if we need it.

Under your ext folder or widget folder ( mine under **protected/ext/data** ) create the following widget:


 
 

```php
class EBackButtonWidget extends CWidget {
[...]
}

 
``` Where: <br/> 
 
1. Back is the text that the button will show. <br/> 2. name will be the name of the button  <br/> 
3. class just in case that you want to do it pretty :).
4. styles that you want to use. In my case I will change the width.
[...]
To call this widget we simple:


 

```php
<?
[...]
```

Where :
<br>
 
1. application.ext.data.EBackButtonWidget is the path to our widget.<br> 2. width will be the width param that we give to the widget.<br> And that is it !! <br>
 
 
Here's a very readable link in spanish to the original [tutorial][original]. [original]: http://www.cristiantala.cl/crear-un-widget-en-yii-boton-volver/