Yii Framework Forum: Editing _view.php - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Editing _view.php Rate Topic: -----

#1 User is offline   Jimlam 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 195
  • Joined: 17-March 12

Posted 29 March 2012 - 02:10 PM

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
0

#2 User is offline   DoniRS 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 25-March 12
  • Location:Netherlands

Posted 29 March 2012 - 03:43 PM

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

#3 User is offline   Jimlam 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 195
  • Joined: 17-March 12

Posted 31 March 2012 - 05:53 AM

View PostDoniRS, on 29 March 2012 - 03:43 PM, said:

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">



<b><?php echo CHtml::encode($data->getAttributeLabel('id')); ?>:</b>
<?php echo CHtml::link(CHtml::encode($data->id), array('view', 'id'=>$data->id)); ?>
<br />

<b><?php echo CHtml::encode($data->getAttributeLabel('description')); ?>:</b>
<?php echo CHtml::encode($data->description); ?>
<br />

<b><?php echo CHtml::encode($data->getAttributeLabel('maxnormal')); ?>:</b>
<?php echo CHtml::encode($data->maxnormal); ?>
&nbsp

<b><?php echo CHtml::encode($data->getAttributeLabel('maxadd')); ?>:</b>
<?php echo CHtml::encode($data->maxadd); ?>
<br />

<table>
<tr><th>xxxx</th><th>xxxxxxxx</th><th>xxxxxxxxx</th><th>xxxxxx xxx</th><th>xxxxxxx</th></tr>

<tr><td><?php echo CHtml::encode($data->getAttributeLabel('onebo')); ?></td>
<td><?php echo CHtml::encode($data->onebo); ?></td>
<td><?php echo CHtml::encode($data->onebb); ?></td>
<td><?php echo CHtml::encode($data->onehb); ?></td>
<td><?php echo CHtml::encode($data->onefb); ?></td>
</tr>

<tr><td><?php echo CHtml::encode($data->getAttributeLabel('twobo')); ?></td>
<td><?php echo CHtml::encode($data->twobo); ?></td>
<td><?php echo CHtml::encode($data->twobb); ?></td>
<td><?php echo CHtml::encode($data->twohb); ?></td>
<td><?php echo CHtml::encode($data->twofb); ?></td>
</tr>
</table>

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


table
{
border:1px solid #C9E0ED;
table-layout: fixed;
width: 75%;
}

th
{
border:2px solid white;
background-color: #C9E0ED;
}


td
{
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?

Thanks
0

#4 User is offline   outrage 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 288
  • Joined: 10-November 09
  • Location:Blackpool, United Kingdom

Posted 02 April 2012 - 12:42 PM

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%">

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users