Skip to content

Commit

Permalink
fixed controller name && created class for seo controllers extending …
Browse files Browse the repository at this point in the history
…&& readme fix
  • Loading branch information
Mikalai Shershan committed Oct 30, 2015
1 parent 1f21a5f commit c79822f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CustomView.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ private function addMeta($metaArray)

private function buildControllerClass()
{
return sprintf('%s\%sController', $this->controllerNamespace, ucfirst($this->controller->id));
preg_match('/\\w*$/', $this->controller->className(), $result);
$className = $result[0];
return sprintf('%s\%s', $this->controllerNamespace, $className);
}

private function buildActionFunction()
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ in config file:
```
seo controller example:
```sh
class SiteController
use shnm\SeoController;

class SiteController extends SeoController
{
public function actionIndex()
{
$this->title = 'Hello world!';

return [
['name' => 'keywords', 'value' => $this->getKeywords()],
['name' => 'description', 'value' => 'Cool page!'],
Expand Down
13 changes: 13 additions & 0 deletions SeoController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace shershennm\seo;

use Yii;
use yii\base\Object;

abstract class SeoController extends Object
{
public
$controller,
$title;
}

0 comments on commit c79822f

Please sign in to comment.