Skip to content

Instantly share code, notes, and snippets.

@fedek6
Created May 24, 2017 17:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedek6/62a0c63f63cf71270c4b96266eafed0e to your computer and use it in GitHub Desktop.
Save fedek6/62a0c63f63cf71270c4b96266eafed0e to your computer and use it in GitHub Desktop.
Replace param in URL for form usage in Yii 1.1.*
<?php
/** @var array $params Current get params without c **/
$params = $_GET;
unset( $params[ 'c' ] );
/** @var string $url **/
$url = Yii::app()->controller->createUrl( Yii::app()->controller->id . '/' . Yii::app()->controller->action->id, $params );
/**
* Create form with nedded c param included.
*/
echo TbHtml::beginFormTb(TbHtml::FORM_LAYOUT_INLINE, $url, 'GET', [ 'class' => 'plugin-submit-onchange' ]);
echo TbHtml::label('Number of items in list:', 'c');
echo TbHtml::dropDownList( 'c', $this->_c, $this->options );
echo TbHtml::endForm();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment