Editing _view.php

I am trying to change the look of the _view.php file (generated by Yii) which is called by the index.php of a model. I have placed some record info in a table with some particular style but the style of the table is just completely ignored. I have tried to modify the css files involved but without success. Can anybody please help me? Thanks

Can you post some of the modified code and which css files did you changed ?


Hi DoniRS,

I undid all changes to the file the first time. What I remember I did was that I included the style in the table element of the _view.php file itself. I don’t know why it did not work. Then I modified the main.css file but here I guessed I made a syntax mistake. Finally I succeeded in doing it. Here is the modified code for _view.php:

<div class="view">

&lt;b&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('id')); ?&gt;:&lt;/b&gt;

&lt;?php echo CHtml::link(CHtml::encode(&#036;data-&gt;id), array('view', 'id'=&gt;&#036;data-&gt;id)); ?&gt;

&lt;br /&gt;

&lt;b&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('description')); ?&gt;:&lt;/b&gt;

&lt;?php echo CHtml::encode(&#036;data-&gt;description); ?&gt;

&lt;br /&gt;

&lt;b&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('maxnormal')); ?&gt;:&lt;/b&gt;

&lt;?php echo CHtml::encode(&#036;data-&gt;maxnormal); ?&gt;


&lt;b&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('maxadd')); ?&gt;:&lt;/b&gt;

&lt;?php echo CHtml::encode(&#036;data-&gt;maxadd); ?&gt;

&lt;br /&gt;


&lt;tr&gt;&lt;th&gt;xxxx&lt;/th&gt;&lt;th&gt;xxxxxxxx&lt;/th&gt;&lt;th&gt;xxxxxxxxx&lt;/th&gt;&lt;th&gt;xxxxxx  xxx&lt;/th&gt;&lt;th&gt;xxxxxxx&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt;&lt;td&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('onebo')); ?&gt;&lt;/td&gt;

&lt;td&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;onebo); ?&gt;&lt;/td&gt;

&lt;td&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;onebb); ?&gt;&lt;/td&gt;

&lt;td&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;onehb); ?&gt;&lt;/td&gt;

&lt;td&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;onefb); ?&gt;&lt;/td&gt;		


&lt;tr&gt;&lt;td&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('twobo')); ?&gt;&lt;/td&gt;

&lt;td&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;twobo); ?&gt;&lt;/td&gt;

&lt;td&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;twobb); ?&gt;&lt;/td&gt;

&lt;td&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;twohb); ?&gt;&lt;/td&gt;

&lt;td&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;twofb); ?&gt;&lt;/td&gt;



I added the following code to the main.css file:



border:1px solid #C9E0ED;

table-layout: fixed;

width: 75%;




border:2px solid white;

background-color: #C9E0ED;




border:1px solid #C9E0ED;


What I want to know is why does it not work when the style is inserted in the _view.php file itself?


I guessing it’s a simple syntax error still.

I’ve tried to do the same as you’re describing and it works as it should.

Perhaps you could show us your example?

You can always add the css inline until you figure out your problem:

<table style="border:1px; width:75%">