PHPackages                             davidyell/viewbits - 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. [Templating &amp; Views](/categories/templating)
4. /
5. davidyell/viewbits

AbandonedArchivedCakephp-plugin[Templating &amp; Views](/categories/templating)

davidyell/viewbits
==================

CakePHP 2.x component for dynamically loading content as bits into a page matched by route.

0.1.11(10y ago)2287PHP

Since May 9Pushed 10y ago1 watchersCompare

[ Source](https://github.com/davidyell/CakePHP-ViewBits)[ Packagist](https://packagist.org/packages/davidyell/viewbits)[ RSS](/packages/davidyell-viewbits/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (1)Versions (10)Used By (0)

ViewBits Component
==================

[](#viewbits-component)

Why?
----

[](#why)

I needed a way to allow certain blocks of content in a view to be content managed without affecting the layout.

What it does
------------

[](#what-it-does)

It will hook `beforeRender()` to match a route in order to load the View Bits that you need for that route. So that you can include them in your views.

Compatability
-------------

[](#compatability)

Compatible with CakePHP `2.x`. (Developed on `2.2.3`)

Installation
------------

[](#installation)

- Download and unzip into `app/Plugins/ViewBits`
- `$ git clone https://github.com/davidyell/CakePHP-ViewBits.git app/Plugin/ViewBits`
- `$ git submodule add https://github.com/davidyell/CakePHP-ViewBits.git app/Plugin/ViewBits`

Setup
-----

[](#setup)

First you will need to create the database table to store your View Bits.

Import the `view_bits.sql` file from `app/Plugin/ViewBits/Config/Schema/view_bits.sql`
**OR**
You can use [CakeDC/migrations](https://github.com/cakedc/migrations) to run the migration file.
`cake Migrations.migration run --plugin ViewBits`

Then you'll want to enable the plugin in your `app/Config/bootstrap.php` with `CakePlugin::load('ViewBits')`. If you are already using `CakePlugin::loadAll()` then you don't have to worry.

To enable the component it will need to be included in your controllers `$components` array. I'd suggest adding it to your `AppController.php`

```
class AppController extends Controller {
    public $components = array('ViewBits.ViewBits');
}
```

Usage
-----

[](#usage)

The component will match based on the routes in the url. So if you add a View Bit with a route of `/` it will be loaded on your root or home page. If you add one with a route of `/pages/display/about` it will show up on your about page.
Wild cards are also supported in the routing using `*`. If you add a route of `*` the ViewBit will be loaded on all pages. You can combo them up such as `/users/*` which will load on all the UsersController routes.

In order to display your View Bits, you'll need to include the plugin helper which outputs the content. In your controller you must add the helper to your helpers array.

```
public $helpers = array('ViewBits.ViewBits');
```

Example

```

// $viewbits is an array of items generated by the component
// 1 is the item you want to output
```

What you have to do
-------------------

[](#what-you-have-to-do)

You'll need to customise the admin interface and deal with hooking it into your current admin. The admin views are based on my [NiceAdmin](https://github.com/davidyell/CakePHP-NiceAdmin) plugin.

Todo
----

[](#todo)

### v0.1 Milestone

[](#v01-milestone)

- Create a helper to replace the element
- Come up with a better way to manage multiple View Bits in the new Helper
- Ordering so that bits are loaded in the page order
- Enhance the route matching to take regex, wildcards or similar
- Validate the routes to make sure they exist
- Custom validation function to lookup routes and make sure they exist
- Setup for Composer and add to Packigist

\##License [![Creative Commons License](https://camo.githubusercontent.com/2e47850e627609184fe5412d84bb63ab98727d1fd1ff5b534c73d0f174f32ea5/687474703a2f2f692e6372656174697665636f6d6d6f6e732e6f72672f6c2f62792d73612f332e302f38387833312e706e67)](http://creativecommons.org/licenses/by-sa/3.0/deed.en_US)
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/deed.en_US).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~84 days

Recently: every ~70 days

Total

9

Last Release

3710d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d57752a98aa935325fbb6daf6ddb0fa42e4c8576f84a82e7ce8e263fa04ba852?d=identicon)[davidyell](/maintainers/davidyell)

---

Top Contributors

[![davidyell](https://avatars.githubusercontent.com/u/49889?v=4)](https://github.com/davidyell "davidyell (7 commits)")

### Embed Badge

![Health badge](/badges/davidyell-viewbits/health.svg)

```
[![Health](https://phpackages.com/badges/davidyell-viewbits/health.svg)](https://phpackages.com/packages/davidyell-viewbits)
```

###  Alternatives

[wp-bootstrap/wp-bootstrap-navwalker

A custom WordPress nav walker class to fully implement the Bootstrap 4 navigation style in a custom theme using the WordPress built in menu manager.

3.3k44.3k](/packages/wp-bootstrap-wp-bootstrap-navwalker)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)[silverstripe-themes/simple

The SilverStripe simple theme (default SilverStripe 3 theme)

411.3M8](/packages/silverstripe-themes-simple)[pressbooks/pressbooks-book

This theme is named after Canadian media theorist Marshall McLuhan, who coined the phrase “the medium is the message.” It is designed for academic writing and is also suitable for fiction. Headings are set in Cormorant Garamond, and body type is set in Lora.

216.6k](/packages/pressbooks-pressbooks-book)[mediawiki/vector-skin

Modern version of the MonoBook skin

533.5k](/packages/mediawiki-vector-skin)[frozzare/digster

Twig templates for WordPress

107.1k](/packages/frozzare-digster)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
