I developed a yii web application, and I changed the default css even I changed the images, but after I uploaded into my server which I hosted from bluhost, the Gridview css does not changed and the default images for icons(updare,View,delete) are still there.
what I did is I uploaded my wep application folder and yii framework folder.
So can you help me what is going wrong
You can disable default css by adding 'cssFile'=>false in Your CGridView widget. You can also add path to Your css file instead of false value.
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'model-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'cssFile'=>false,
// 'cssFile'=>'path_to_your/file.css',
'columns'=>array(
'id',
'name',
array(
'class'=>'CButtonColumn',
),
),
)); ?>
Related
I'm busy developing my first custom theme on WordPress. I have converted and created all the files and everything is working as it should. The original files are based on Bootstrap, but I have converted the stylesheets to not be dependant. I am finally at a place where I want to allow users some customization and among other things, would like to add the ability to change theme colors.
I created a separate customize.php file that handles my customizer code. I have also added the WP Color Picker component and it does show up in the WP dashboard > Appearance > Customize window. The problem is that it doesn't actually work...
As part of my testing, to ensure that Bootstrap wasn't affecting anything, I created a div and gave it a custom class name (one that isn't found anywhere else on the website), I gave the div some height and width, and inside, I added a p-tag just to have some content. What I would like to do, is create a section (in the customizer) that will allow users to change the background color of the div
In the customize.php file:
<?php
function myTheme_customize_register($wp_customize){
$wp_customize->add_section('colors', array(
'title' => __('Colors', 'myTheme'),
'priority' => 30
));
$wp_customize->add_setting('bg_color', array(
'default' => '#f0a709',
'transport' => 'postMessage', // I have also tried 'refresh'
));
$wp_customize->add_control( new WP_Customize_Color_Control ($wp_customize, 'bg_color', array(
'label' => __('Background Color', 'myTheme'),
'section' => 'colors',
'settings' => 'bg_color',
)));
}
add_action('customize_register', 'myTheme_customize_register');
In my functions.php:
<?php
function myTheme_customize_css(){ ?>
<style type="text/css">
.hi{
background-color: <?php echo get_theme_mod('bg_color', '#f0a709'); ?> !important;
}
</style>
<?php
}
add_action('wp-head', 'myTheme_customize_css');
require get_template_directory().'/inc/customize.php';
?>
In the Customizer, the section 'Colors' is available and also the Color Picker, but selecting another color does nothing. The option for additional CSS is also available, and to test, when selecting the div and giving it a custom bg-color, the color does indeed change. I have also created another section of code in the customizer.php which handles some custom footer settings, things like heading text and button customization, and that's working just fine. I have a feeling the solution is really simple but I'm just not seeing it. Any help would be greatly appreciated.
The action will be like this :
add_action('wp_head', 'myTheme_customize_css');
You write the action name wrong. It will work as expected.
I have a CGridView, one particular column is CLinkColumn. The footer for this column presently appears in plain text, I need it to be hyperlinked as well.
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$provider_sales,
'columns'=>array(
...,
array(
'header'=>'Status',
'class'=>'CLinkColumn',
'urlExpression'=>function($data){ return ...},
'footer'=> number_format($totals['status']),
),
),
));
How do I convert it to a hyperlink?
Now I just need one footer item to hyperlink, this could change tomorrow.
Hi You can simply use this CHtml::link in footer
'footer'=> CHtml::link(number_format($totals['status']),Yii::app()->createUrl("Your_Url"),array("target"=>"_blank")),
You can also pass param in this
CHtml::link('Link Text',array('controller/action',
'param1'=>'value1'));
For more info please read http://www.yiiframework.com/wiki/48/by-example-chtml/#hh0
i have a CgridView thats being loaded on ajax inside a modal, i want the pagers and filters to update the data via ajax (for now is just making an url request which changes the page to the url that only shows the cgridview). I know the widget has ajaxUpdate property but i don't know how to use it and i'm not sure if what i'm looking is what the property can do.
the widget:
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'champions-grid',
'dataProvider'=>$dataProvider,
'itemsCssClass'=>'table',
'columns'=>array(
'Name',
'AttackDamage',
'AttackSpeed',
),
));
Update: I found out this widget uses it's own javascript library, but as it is being loaded via ajax (sorry for not to mention it earlier), the javascript is not loaded, however i know this won't tell how to make updates via ajax, i just thought i had to write this down here.
you would need to add
'ajaxUpdate'=>true,
So that code should look like
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'champions-grid',
'dataProvider'=>$dataProvider,
'ajaxUpdate'=>true,
'itemsCssClass'=>'table',
'columns'=>array(
'Name',
'AttackDamage',
'AttackSpeed',
),
));
I disabled core css file because it was intercepting with my custom css files:
$cs = Yii::app()->getClientScript();
$cs->scriptMap = array(
'*.css' => false,
);
Now, I need core css files in one view only.
Is there anyway to include those core css files in one view?
You can do it like this
In config/main.php under components section
'clientScript'=>array(
'packages'=>array(
'CoreCss'=>array(
'baseUrl'=> 'css/' ,
'css'=>array('main.css','ie.css','form.css','screen.css','print.css'),
),
),
In any page you want to register this css use below lines..
$cs = Yii::app()->clientScript;
$cs->registerPackage('CoreCss');
may be this things can help you...
I use CGridView in Yii to create tables. I would like to show my table with pagination, but display summary text (i.e. Displaying 1-4 of 4 results.) at the bottom of grid. Is it possible in Yii?
You need to add this property to your array options widget:
'template'=>'{items}{summary}{pager}'
This is how it should look like:
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$model->search(),
'filter'=>$model,
'enablePagination' => true,
'template'=>'{items}{summary}{pager}',
'columns'=>array(...)
),
));
Yii docs - CBaseListView
'template'=>"{summary}\n{items}\n{pager}"