Which allows me to display Yes or No, according to the database value of 1 or 0. Now it seems that the same functionality is not available in CDetailView. I have tried the code below, and the value comes out as, literally, ($data->f_user_admin===0)?"No":"Yes".
Does anyone have a suggestion as to how I can accomplish applying an expression within CDetailView? One would think the the same functionality that works in CGridView would work here.
In hindsight, you’re right, it is obvious! The fact that the example I had found for the CGridView contained the quotes, and worked, is what threw me off.
Thanks for responding, despite my silly oversight. It has saved me needless headaches.
I just found an interesting, related thread: CDetailView with Function
The bottom line: it should work without single quotes on CDetailView and with single quotes on CGridView. You can try a function in place of the ternary (see link for example).
Is there a reason for using the identical operator (===) in your expression rather than just using the equal operator (==)? If you don’t have to verify the type of the value, then it’s not necessary. I set up a test with code similar to yours and once I switched the expression to remove the quotes and use the equal operator it worked with no issues: