PHPackages                             marcogmonteiro/ci-admin-controller - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. marcogmonteiro/ci-admin-controller

Abandoned → [mpmont/ci-toolkit](/?search=mpmont%2Fci-toolkit)Library[Framework](/categories/framework)

marcogmonteiro/ci-admin-controller
==================================

View autoloading for Codeigniter 4 Framework

1.1.7(5y ago)191043[5 issues](https://github.com/mpmont/ci4-adminController/issues)MITPHP

Since Jun 21Pushed 5y ago3 watchersCompare

[ Source](https://github.com/mpmont/ci4-adminController)[ Packagist](https://packagist.org/packages/marcogmonteiro/ci-admin-controller)[ RSS](/packages/marcogmonteiro-ci-admin-controller/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (7)DependenciesVersions (5)Used By (0)

codeigniter 4 base controller
=============================

[](#codeigniter-4-base-controller)

[![GitHub version](https://camo.githubusercontent.com/f2fac71c7cca36f5a0624732df6ebcd22907215ee417731e05faa2206eb776f7/68747470733a2f2f62616467652e667572792e696f2f67682f6d706d6f6e742532466369342d61646d696e436f6e74726f6c6c65722e737667)](https://badge.fury.io/gh/mpmont%2Fci4-adminController)

codeigniter-base-controller is an extended `BaseController` class to use in your CodeIgniter applications. Any controllers that inherit from `BaseController` or `AdminController` get intelligent view autoloading and layout support. It's strongly driven by the ideals of convention over configuration, favouring simplicity and consistency over configuration and complexity.

Synopsis a controller that extends to adminController
-----------------------------------------------------

[](#synopsis-a-controller-that-extends-to-admincontroller)

```

Footer

```

If you wish to disable the layout entirely and only display the view - a technique especially useful for AJAX requests - you can set `$this->layout` to `FALSE`.

```
$this->layout = FALSE;

```

Like with `$this->view`, `$this->layout` can also be used to specify an unconventional layout file:

```
$this->layout = 'layouts/mobile.php';

```

Any variables set in `$this->data` will be passed through to both the view and the layout files.

View structure
--------------

[](#view-structure)

Your views should be created to support the built in functionality of layouts that comes with codeigniter 4

```

    Hello World from the home/index view!

```

As for your layouts, those should have a render section called yield.

```

    My Layout

    This is my layout content

```

To actually be able to rendere a view directly without the layout we need an empty layout doing the render. For that there's a nolayout.php file included in your Views/layouts folder that only does the view render.

```

```

The complete folder structure is now included in the project.

Loading Helpers in your controllers
-----------------------------------

[](#loading-helpers-in-your-controllers)

If you want to load helpers in your controllers in a global scope and not inside a function all your have to do is declare the helpers property as array with all your helpers, like so:

```
