Jump to content


Photo
- - - - -

Уникальные метатеги (title и description) при пагинации каталога

title пагинация

Best Answer Kess , 16 September 2013 - 22:59

У меня получилось так:
 
В файле components/com_zoo/controllers/default.php, в "public function category()" находим эти строки:

if ($title) {
    $this->app->document->setTitle($this->app->zoo->buildPageTitle($title));
}

if ($description) {
    $this->app->document->setDescription($description);
}

и меняем на это:

if ($title) {
    if ($page > 1) {
        $this->app->document->setTitle($this->app->zoo->buildPageTitle($title . ' стр. ' . $page));
    }
    else {
        $this->app->document->setTitle($this->app->zoo->buildPageTitle($title));
    }
}

if ($description) {
    if ($page > 1) {
        $this->app->document->setDescription($description . ' стр. ' . $page);
    }
    else {
        $this->app->document->setDescription($description);
    }
}

Description будет ставиться, если он явно указан в настройках категории.
 

Go to the full post


  • This topic is locked This topic is locked
1 reply to this topic

#1 An1hony

An1hony
  • JBZoo User (rus)
  • User rate: 0
  • posts: 145
  • topics: 72

Posted 16 September 2013 - 21:54

Каким образом сделать так, чтобы на страницах каталога, начиная со второй, в title и description указывался номер страницы?

 

Например,

 

на странице /index.php/new-buildings/developers/3 должен дописываться текст "стр.3";

на странице /index.php/new-buildings/developers/7 должен дописываться текст "стр.7";

 

ну и так далее...

 


  • 0

#2 Kess

Kess
  • JBZoo User (rus)
  • User rate: 11.9
  • posts: 406
  • topics: 40

Posted 16 September 2013 - 22:59   Best Answer

У меня получилось так:
 
В файле components/com_zoo/controllers/default.php, в "public function category()" находим эти строки:

if ($title) {
    $this->app->document->setTitle($this->app->zoo->buildPageTitle($title));
}

if ($description) {
    $this->app->document->setDescription($description);
}

и меняем на это:

if ($title) {
    if ($page > 1) {
        $this->app->document->setTitle($this->app->zoo->buildPageTitle($title . ' стр. ' . $page));
    }
    else {
        $this->app->document->setTitle($this->app->zoo->buildPageTitle($title));
    }
}

if ($description) {
    if ($page > 1) {
        $this->app->document->setDescription($description . ' стр. ' . $page);
    }
    else {
        $this->app->document->setDescription($description);
    }
}

Description будет ставиться, если он явно указан в настройках категории.
 


Edited by Kess, 16 September 2013 - 23:03.

  • 0





Click to return to top of page in style!