LoginSignup
4
4

More than 5 years have passed since last update.

TwitterBootstrap3対応のCakePluginはTwitterBootstrapではない

Posted at

2系によく使われていたCakeのプラグインにTwitterPluginがあったが、3系にバージョンアップした時に当然そのままではページネーションが効いてなかった。
TwitterBootstrapのGithubを見に行くと1年近く更新がなかったので、他のプラグインが無いか探していたら同じ方が3系と2系に対応したプラグインを開発していたので、ありがたく使わせていただきました。

BoostCake インストール手順

1.以下のURLに置いてあるリポジトリをCakeのPluginディレクトリにcloneしてくる。
http://slywalker.github.io/cakephp-plugin-boost_cake/
2.プラグインを読み込む
Config/bootstrap.phpに下記コードを追加

bootstrap.php
CakePlugin::load('BoostCake');
// または
CakePlugin::loadAll();

3.利用するControllerからプラグインを読み込む

HogeController.php
class HogeController extends AppController {
    public $name = 'Hoge';

    // BoostCakeを読み込み
    public $helpers = array(
        'Html' => array('className' => 'BoostCake.BoostCakeHtml'),
        'Form' => array('className' => 'BoostCake.BoostCakeForm'),
        'Paginator' => array('className' => 'BoostCake.BoostCakePaginator'),
    );
}

これで準備OK

BoostCake ページネート

入れ替えた時にぱっと見で崩れていたのがページネートくらいだったので、ひとまずページネートのみ
他にも修正が必要な箇所があれば適宜追加して行きます。

before_view
<?php
    echo $this->Paginator->pagination(array(
        'div' => 'pagination'
    ));
?>
after_view
<?php
    echo $this->Paginator->pagination(array(
        'ul' => 'pagination'
    )); 
?>
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4