PHP Classes

How to Implement a Breadcrumbs PHP Solution in Web Page Action Controllers usingYii2 Metacrumbs: Generate breadcrumbs for navigating between pages

Recommend this page to a friend!

  Author Author  
Picture of Insolita
Name: Insolita <contact>
Classes: 15 packages by
Country: Russian Federation Russian Federation
Age: 37
All time rank: 354397 in Russian Federation Russian Federation
Week rank: 9 Up1 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 9x


  Detailed description   Download Download .zip .tar.gz  
This package can generate breadcrumbs for navigating between pages.

It provides classes that define the structure of breadcrumbs to navigate between pages generated using controller classes of MVC applications that use the YII framework.

The package also provides classes that can generate meta-tags that define a property of the pages like titles, descriptions, images, etc...

Details

Yii2 meta-crumbs pack

alternative way for work with breadcrumbs and metadata with open-graph-protocol helpers

also include NoLayoutBehavior for registration actions where layout must be skipped

Status Latest Stable Version Total Downloads License

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist insolita/yii2-metacrumbs "~2.0"

or add

"insolita/yii2-metacrumbs": "~1.0"

to the require section of your composer.json file.

Usage

- register MetaCrumbsBootstrap, or manual register as singleton :

 \Yii::$container->setSingleton(IBreadcrumbCollection::class,BreadCrumbs::class);

and/or

 \Yii::$container->setSingleton(IMetaManager::class,MetaManager::class);

- add widget in layout

       <?= \insolita\metacrumbs\widgets\CrumbWidget::widget([]) ?>

- add CrumbedControllerTrait in base controller (or in needed controllers) and register crumbs - add MetaManagerTrait in needed controllers or base controller (also in service possible)

Controller Example

 class ExampleController extends Controller
 {
     use CrumbedControllerTrait;
     use MetaManagerTrait;

     public function actions()
     {
         return [
             'error'   => [
                 'class' => 'yii\web\ErrorAction',
             ],
         ];
     }

    public function behaviors()
    {
        return [
            'nolayout'=>['class'=>NoLayoutBehavior::class,'actions' => ['ajax']]
            // 'nolayout'=>['class'=>NoLayoutBehavior::class,'actions' => ['index','about'],'except'=>true]

        ];
    }
     public function beforeAction($action)
     {
         $this->registerHomeCrumb();
         $this->registerIndexCrumb('??????');
         if ($action->id == 'error') {
             $this->registerCurrentCrumb('???????? ??????');
             $this->metaManager()->canonical();
         }
         return parent::beforeAction($action);
     }

    public function actionIndex()
    {
        $this->metaManager()->canonical(Url::to(['example/default']));
        $this->metaManager()->tag('description', 'Bla-bla-la-la-la');
        $this->metaManager()->prop('og:description', 'Bla-bla-bla');
        $this->metaManager()->prop('og:title', 'Bla-bla-bla');
        $this->metaManager()->keywords('Some, keywords,list');
        //Also
        return $this->render('index');
    }
     public function actionView(int $id)
     {
          $this->crumbCollection->addCrumb(
                new CrumbItem('Special crumb', Url::to(['some/page']), 20, ['target' => '_blank'])
           );
          $model = $this->pageFinder->findById($id);
          $this->registerCurrentCrumb($model->title);
          $this->metaManager()->ogMeta($model->title,Url::current([],true),$model->description,$model->cover,'article');
          return $this->render('about',['model'=>$model]);
     }

     ....

  Classes of Insolita  >  How to Implement a Breadcrumbs PHP Solution in Web Page Action Controllers usingYii2 Metacrumbs  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: How to Implement a Breadcrumbs PHP Solution in Web Page Action Controllers usingYii2 Metacrumbs
Base name: yii2-metacrumbs
Description: Generate breadcrumbs for navigating between pages
Version: -
PHP version: 5
License: MIT/X Consortium License
All time users: Not yet counted
All time rank: Not yet ranked
Week users: Not yet counted
Week rank: Not yet ranked
 
  Groups   Rate classes User ratings   Applications   Files Files  

  Groups  
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Graphics Colors, images, charts and picture formats View top rated classes
Group folder image Design Patterns Implementations of well known design patterns View top rated classes


  User ratings  
Not yet rated by the users

  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file, 3 directories)
Files folder imagetests (4 files, 2 directories)
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file codeception.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imagecomponents (5 files)
Files folder imagemixins (3 files)
Files folder imagewidgets (1 file)
  Plain text file MetaCrumbsBootstrap.php Class Class source

  Files folder image Files  /  src  /  components  
File Role Description
  Plain text file BreadCrumbs.php Class Class source
  Plain text file CrumbItem.php Class Class source
  Plain text file IBreadcrumbCollection.php Class Class source
  Plain text file IMetaManager.php Class Class source
  Plain text file MetaManager.php Class Class source

  Files folder image Files  /  src  /  mixins  
File Role Description
  Plain text file CrumbedControllerTrait.php Class Class source
  Plain text file MetaManagerTrait.php Class Class source
  Plain text file NoLayoutBehavior.php Class Class source

  Files folder image Files  /  src  /  widgets  
File Role Description
  Plain text file CrumbWidget.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imageconfig (2 files)
Files folder imageunit (4 files, 1 directory)
  Accessible without login Plain text file .env Data Auxiliary data
  Accessible without login Plain text file bootstrap.php Example Example script
  Accessible without login Plain text file unit.suite.yml Data Auxiliary data
  Accessible without login Plain text file yii Example Example script

  Files folder image Files  /  tests  /  config  
File Role Description
  Accessible without login Plain text file base.php Aux. Auxiliary script
  Accessible without login Plain text file console.php Aux. Auxiliary script

  Files folder image Files  /  tests  /  unit  
File Role Description
Files folder imagewidgets (1 file)
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Plain text file BreadCrumbsTest.php Class Class source
  Plain text file MetaManagerTest.php Class Class source
  Plain text file NoLayoutBehaviorTest.php Class Class source

  Files folder image Files  /  tests  /  unit  /  widgets  
File Role Description
  Plain text file CrumbWidgetTest.php Class Class source

Download Download all files: yii2-metacrumbs.tar.gz yii2-metacrumbs.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.