Daniel
Daniel

Reputation: 215

yii remove leftover code after removing the standard sidebar in create form

I have a create form which is loaded using renderPartial (standard after using the yii crud tool):

<?php echo $this->renderPartial('_form', array('model'=>$model)); ?>

I removed the code which renders the sidebar menu, and the menu doesn't show anymore. But still there's some generated code left when I look into browser my source code:

<div class="span-5 last">
    <div id="sidebar">
        </div><!-- sidebar -->
</div>

This messes up my layout and I can't find where I can remove this last part. Does someone know where this happens?

Upvotes: 1

Views: 352

Answers (1)

The Humble Rat
The Humble Rat

Reputation: 4696

There are two things to consider here, do you want this removed over the whole site (i'll explain all methods). If so go to the following directory

/protected/views/layouts

Then edit the column2 layout, which is likely the default layout being used and remove the sidebar code. Now all pages should no longer have the sidebar.

If you want to remove this either on all actions of a controller or for a specific controller action, do the following. Duplicate colum2.php and call it say nosidebar.php. Then in the nosidebar.php file, remove the sidebar code.

To change all actions in a controller specifiy the layout like so.

class AccountsController extends Controller
{

public $layout='//layouts/nosidebar';

or to change a specific action add this inside the action method

$this->layout='nosidebar';

Upvotes: 2

Related Questions