Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7918807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:37:59+00:00 2026-06-03T15:37:59+00:00

Is there a global setting in Yii to change the htmlentity display from ©

  • 0

Is there a global setting in Yii to change the htmlentity display from "©" to "©"
for admin(ajax grid)/view/ and edit views?

I found that in the CGridView parameters, I can go and update each column to 'type'=>'raw' like below, but I will need to do this in twenty Models, and and each view manually unless I can do its globally somewhere. I have a script that imports the data with ©, and when the customers go to edit an item, they would like to see ©. Any help is appritiated!

<?php $this->widget('zii.widgets.grid.CGridView', array(

        'id'=>'item-grid',
        'dataProvider'=>$model->search(),
        'filter'=>$model,

        'columns'=>array(
                'id',
                'price1',
                'price1label',
                'price2',
                'price2label',
                array('name'=>'name','type'=>'raw'), // this will display the raw entity
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:38:02+00:00Added an answer on June 3, 2026 at 3:38 pm

    There’s no such functionality built into Yii, but as is usually the case you can extend a couple of classes to achieve the aim.

    First off, note that this is the property whose default value you ‘d like to change. If you could¹ do that, then all the problems would go away.

    Since you can’t, you need to extend CDataColumn to achieve this. Dead simple:

    Yii::import('zii.widgets.grid.CDataColumn');
    
    class SpecialDataColumn extends CDataColumn {
        public $type = 'raw'; // that's all!
    }
    

    Now the problem is that you also need to tell Yii to use your special column class instead of the built-in. You can do this by specifying the type of each column in the CGridView instantiation, but that’s not acceptable because you still have the problem of needing to edit every column in every view. So we ‘ll have to look into how CGridView decides to use a CDataColumn and override that.

    Grepping a little shows that this is the code you need to modify. Specifically, there are two lines of interest:

    $column=$this->createDataColumn($column);
    

    and

    $column['class']='CDataColumn';
    

    So, you need to override the createDataColumn method (to change what the first line does) and the initColumns method (to edit the second line). Here we go:

    Yii::import('zii.widgets.grid.CGridView');
    
    class SpecialGridView extends CGridView {
        protected function initColumns() {
            // copy all of the stock implementation code, changing only
            // $column['class']='CDataColumn' to $column['class']='SpecialDataColumn'
        }
    
        protected function createDataColumn($text)
        {
            // copy all of the stock implementation code, changing only
            // $column=new CDataColumn($this) to $column=new SpecialDataColumn($this)
        }
    }
    

    After this is done, you are just one more edit away from happiness:

    this->widget('SpecialGridView', ...);
    

    You still need to make this edit in every view that uses a data grid, but that shouldn’t take more than a few seconds with find/replace.


    ¹ Actually, you can simply go to that file inside the framework sources, edit a few characters, save, problem solved. The problem with this approach is that if you upgrade to a later version of Yii, your application will revert to the old behavior without warning. I don’t recommend it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a global .gitconfig setting that allows to change the default of the
I was searching if there is possible to change global size of all components
Is there a way to subscribe to the HttpApplication's BeginRequest event from Global.asax? What
I have a subsite that I have changed the global navigation setting to Display
Is there anyway to set a global image setting, route, or anything so that
I would like to access smtp outgoing mail server address from global setting->mail->accounts->outgoing mail
I know with ASP.NET there's a global handler Application_EndRequest handler where I could change
I am setting global variables in a class which extends from Application. Just getting
Is there anything similar to global variable in SSIS? I have 4 variables (FromAddress,
Is there a way to register for global mouse moved events in Cocoa? I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.