Chtml::linkbutton Parameter

Sorry, couldn’t find any thread discussing this. Hope this is one is good.

I got a question while using CHtml::linkButton. I’d like to generate a link which href refers to some URL. Here is the code:




<?php 

	echo CHtml::linkButton('Print', array(

		'href'=>array('print', $_GET),

		'submit'=>array('print', $_GET),

	));

?>



But somehow the generated link didn’t point to the address. It always point to ‘#’, so I checked the source code of CHtml class. I found this:




/**

 * Generates a link submit button.

 * @param string $label the button label

 * @param array $htmlOptions additional HTML attributes. Besides normal HTML attributes, a few special

 * attributes are also recognized (see {@link clientChange} and {@link tag} for more details.)

 * @return string the generated button tag

 * @see clientChange

 */

public static function linkButton($label='submit',$htmlOptions=array())

{

	if(!isset($htmlOptions['submit']))

		$htmlOptions['submit']=isset($htmlOptions['href']) ? $htmlOptions['href'] : '';

	return self::link($label,'#',$htmlOptions);

}



Looks like it always assign the link to ‘#’, whatever the htmlOptions.

I managed to solve this by editing the source code to:




public static function linkButton($label='submit',$htmlOptions=array())

{

	if(!isset($htmlOptions['submit']))

		$htmlOptions['submit']=isset($htmlOptions['href']) ? $htmlOptions['href'] : '';

	// return self::link($label,'#',$htmlOptions);

	return self::link($label,$htmlOptions['submit'],$htmlOptions);

}



Is there any other solution to manage this (without editing the source code)?

Thanks in advance, and sorry for my bad English.