4

I'm trying to get Yii 1.1.16 to read my custom jQuery-ui.min.css file instead of the one that comes by default.

I tried editing the clientScript in my main.php but cant seem to get it to work.

Here is my code

'components'=>array(
        'clientScript'=>array(
            'scriptMap' => array(
                'jquery-ui.css' => '/css/jquery-ui.min.css',
            ),
            'packages'=>array(
                'jquery'=>array(
                    'baseUrl'=>'js/',
                    'js'=>array('jquery.min.js'),
                ),
               'jquery.ui'=>array(
                    'baseUrl'=>'',
                    'js'=>array('js/jquery-ui.min.js'),
                    'depends' => array('jquery')
                ),
            ),

It adds the default css everytime i call the CJuiButton widget. Any solutions?

1
  • Works for me. Make sure you set right config (main.php) for app. $config = dirname(__FILE__) . '/../app/config/main.php'; Yii::createWebApplication($config)->run(); Commented Sep 6, 2015 at 8:57

1 Answer 1

1

Make sure you set right config (main.php) in index.php:

$config = dirname(__FILE__) . '/../app/config/main.php';
Yii::createWebApplication($config)->run();

If it doesn't work add code bellow before zii.widgets.jui.CJuiButton widget calling:

Yii::app()->clientScript->scriptMap = array(
    'jquery-ui.css' => '/css/jquery-ui.min.css',
);
$this->widget('zii.widgets.jui.CJuiButton',array(
    'buttonType'=>'submit',
    'name'=>'btnSubmit',
    'value'=>'1',
    'caption'=>'Submit form',
    'htmlOptions'=>array('class'=>'ui-button-primary')
    )
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.