# Why does view.ctp change not make affect the view?

**URL:** <https://discourse.cakephp.org/t/why-does-view-ctp-change-not-make-affect-the-view/1704>\
**Category:** Uncategorized\
**Created:** [December 10, 2016, 11:45pm UTC](https://discourse.cakephp.org/t/why-does-view-ctp-change-not-make-affect-the-view/1704 "2016-12-10T23:45:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnny2shoes](https://avatars.discourse-cdn.com/v4/letter/j/977dab/32.png) [@johnny2shoes](https://discourse.cakephp.org/u/johnny2shoes)\
**Post date:** [December 10, 2016, 11:45pm UTC](https://discourse.cakephp.org/t/why-does-view-ctp-change-not-make-affect-the-view/1704/1 "2016-12-10T23:45:27Z")

</div>

I’m new to cakephp. I don’t want to display a column, but, removing it, from view.ctp doesn’t seem to take any affect? Why is that? Also, I have two tables X and Y. But view.ctp for X is showing the Y columns? and the Y view.ctp is showing the X columns? What gives?

---

<div class="post-metadata">

**Author:** ![reuben.helms](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/reuben.helms/32/172_2.png) [@reuben.helms](https://discourse.cakephp.org/u/reuben.helms)\
**Post date:** [December 11, 2016, 11:44am UTC](https://discourse.cakephp.org/t/why-does-view-ctp-change-not-make-affect-the-view/1704/2 "2016-12-11T11:44:01Z")

</div>

Are you sure you’re changing the right file?

Typically, view.ctp shows a single instance of a record, and index.ctp shows a list of records.

If X and Y have a relationship, then the view.ctp for X might list the related Y records.

To prevent confusion, it’s probably better to give code of the view.ctp you are changing, and the actual output as HTML or a screenshot.

---

<div class="post-metadata">

**Author:** ![johnny2shoes](https://avatars.discourse-cdn.com/v4/letter/j/977dab/32.png) [@johnny2shoes](https://discourse.cakephp.org/u/johnny2shoes)\
**Post date:** [December 11, 2016, 12:17pm UTC](https://discourse.cakephp.org/t/why-does-view-ctp-change-not-make-affect-the-view/1704/3 "2016-12-11T12:17:14Z")

</div>

Hi,

Thanks for the reply. X and Y have many-to-many relationship.  
I ran “cake bake all X” and "cake bake all Y"  
X is staff  
Y is client.

under src-\>template-\>staffs-\>view.ctp  
when I change this file ( delete some of the columns from the table because I don’t want to display all of them), save, refresh the page, not seeing any changes

- \<?= \_\_('Actions') ?\>
- \<?= $this-\>Html-\>link(\_\_('Edit Staff'), ['action' =\> 'edit', $staff-\>id]) ?\> 
- \<?= $this-\>Form-\>postLink(\_\_('Delete Staff'), ['action' =\> 'delete', $staff-\>id], ['confirm' =\> \_\_('Are you sure you want to delete # {0}?', $staff-\>id)]) ?\> 
- \<?= $this-\>Html-\>link(\_\_('List Staffs'), ['action' =\> 'index']) ?\> 
- \<?= $this-\>Html-\>link(\_\_('New Staff'), ['action' =\> 'add']) ?\> 
- \<?= $this-\>Html-\>link(\_\_('List Locations'), ['controller' =\> 'Locations', 'action' =\> 'index']) ?\> 
- \<?= $this-\>Html-\>link(\_\_('New Location'), ['controller' =\> 'Locations', 'action' =\> 'add']) ?\> 
- \<?= $this-\>Html-\>link(\_\_('List Clients'), ['controller' =\> 'Clients', 'action' =\> 'index']) ?\> 
- \<?= $this-\>Html-\>link(\_\_('New Client'), ['controller' =\> 'Clients', 'action' =\> 'add']) ?\> 

### \<?= h($staff-\>id) ?\>

```
    <tr>
        <th scope="row"><?= __('Dusername') ?></th>
        <td><?= h($staff->dusername) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Susername') ?></th>
        <td><?= h($staff->susername) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Firstname') ?></th>
        <td><?= h($staff->firstname) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Lastname') ?></th>
        <td><?= h($staff->lastname) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Password') ?></th>
        <td><?= h($staff->password) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Type') ?></th>
        <td><?= h($staff->type) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Sex') ?></th>
        <td><?= h($staff->sex) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Location') ?></th>
        <td><?= $staff->has('location') ? $this->Html->link($staff->location->id, ['controller' => 'Locations', 'action' => 'view', $staff->location->id]) : '' ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Email') ?></th>
        <td><?= h($staff->email) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Phone') ?></th>
        <td><?= h($staff->phone) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Id') ?></th>
        <td><?= $this->Number->format($staff->id) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Depth') ?></th>
        <td><?= $this->Number->format($staff->depth) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Age') ?></th>
        <td><?= $this->Number->format($staff->age) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Created') ?></th>
        <td><?= h($staff->created) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Modified') ?></th>
        <td><?= h($staff->modified) ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Grouper') ?></th>
        <td><?= $staff->grouper ? __('Yes') :__('No'); ?></td>
    </tr>
    <tr>
        <th scope="row"><?= __('Recontacter') ?></th>
        <td><?= $staff->recontacter ? __('Yes') :__('No'); ?></td>
    </tr>
</table>
<div class="related">
    <h4><?= __('Related Clients') ?></h4>
    <?php if (!empty($staff->clients)): ?>
    <table cellpadding="0" cellspacing="0">
        <tr>
            <th scope="col"><?= __('Id') ?></th>
            <th scope="col"><?= __('Username') ?></th>
            <th scope="col"><?= __('Sex') ?></th>
            <th scope="col"><?= __('Location Id') ?></th>
            <th scope="col"><?= __('Age') ?></th>
            <th scope="col"><?= __('Created') ?></th>
            <th scope="col"><?= __('Modified') ?></th>
            <th scope="col" class="actions"><?= __('Actions') ?></th>
        </tr>
        <?php foreach ($staff->clients as $clients): ?>
        <tr>
            <td><?= h($clients->id) ?></td>
            <td><?= h($clients->username) ?></td>
            <td><?= h($clients->sex) ?></td>
            <td><?= h($clients->location_id) ?></td>
            <td><?= h($clients->age) ?></td>
            <td><?= h($clients->created) ?></td>
            <td><?= h($clients->modified) ?></td>
            <td class="actions">
                <?= $this->Html->link(__('View'), ['controller' => 'Clients', 'action' => 'view', $clients->id]) ?>
                <?= $this->Html->link(__('Edit'), ['controller' => 'Clients', 'action' => 'edit', $clients->id]) ?>
                <?= $this->Form->postLink(__('Delete'), ['controller' => 'Clients', 'action' => 'delete', $clients->id], ['confirm' =>__('Are you sure you want to delete # {0}?', $clients->id)]) ?>
            </td>
        </tr>
        <?php endforeach; ?>
    </table>
    <?php endif; ?>
</div>

```

regards

---

<div class="post-metadata">

**Author:** ![reuben.helms](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/reuben.helms/32/172_2.png) [@reuben.helms](https://discourse.cakephp.org/u/reuben.helms)\
**Post date:** [December 11, 2016, 9:27pm UTC](https://discourse.cakephp.org/t/why-does-view-ctp-change-not-make-affect-the-view/1704/4 "2016-12-11T21:27:08Z")

</div>

So, you deleted some related client columns from the staff view template,  
and they are still showing when you view a particular staff member?

You may need to check for caching. In the browser, ensure caching is  
disabled. Check there are not any cached views in app/tmp/cache/views.

Also make sure you are hitting the right action and view. Use Xdebug to  
trace it through, or logging in the controller and view to ensure they  
right ones are being hit.

---

<div class="post-metadata">

**Author:** ![johnny2shoes](https://avatars.discourse-cdn.com/v4/letter/j/977dab/32.png) [@johnny2shoes](https://discourse.cakephp.org/u/johnny2shoes)\
**Post date:** [December 12, 2016, 8:17pm UTC](https://discourse.cakephp.org/t/why-does-view-ctp-change-not-make-affect-the-view/1704/5 "2016-12-12T20:17:25Z")

</div>

Hi,

I was changing view.ctp, but, it’s index.ctp that’s being displayed ( not view.ctp )  
what is view.ctp used for?

oh well, I only wasted 4 days; to change something trivial.

By the way, how do I remove that stupid red strip that’s displayed at the bottome of the screen?

regards

---

<div class="post-metadata">

**Author:** ![reuben.helms](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/reuben.helms/32/172_2.png) [@reuben.helms](https://discourse.cakephp.org/u/reuben.helms)\
**Post date:** [December 20, 2016, 6:40am UTC](https://discourse.cakephp.org/t/why-does-view-ctp-change-not-make-affect-the-view/1704/6 "2016-12-20T06:40:54Z")

</div>

The view.ctp is used when you are looking at a single record, rather than a list of records.

With regards to the red strip, locate the HTML and CSS and remove it from there. If it’s on all the screens, most likely it’s in the layout.ctp. If it’s only a few screens, then it will be a part of the view template for that screen.

---

<div class="post-metadata">

**Author:** ![markstory](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/markstory/32/182_2.png) [@markstory](https://discourse.cakephp.org/u/markstory)\
**Post date:** [December 26, 2016, 4:47am UTC](https://discourse.cakephp.org/t/why-does-view-ctp-change-not-make-affect-the-view/1704/7 "2016-12-26T04:47:21Z")

</div>

The red strip is likely the debug toolbar for CakePHP (DebugKit). You can click the Cake icon to minimize it. If you want to remove the plugin entirely, delete `Plugin::load('DebugKit', ['bootstrap' => true]);` from your application’s `config/bootstrap.php` file.
