php Processwire分页

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Processwire分页相关的知识,希望对你有一定的参考价值。

<?php
//-----------------------------------------------------------------------
//  Add rel="next" and rel="prev" tags for pagination in head section
//-----------------------------------------------------------------------
$wire->addHookAfter('Page::render', function(HookEvent $event) {

  $page = $event->object;
  if($page->template == 'admin') return;

  $tags = '';
  $config = wire('config');

  if($config->urls->httpNext) {
    $tags .= "<link rel='next' href='{$config->urls->httpNext}'>";
  }

  if($config->urls->httpPrev) {
    $tags .= "<link rel='prev' href='{$config->urls->httpPrev}'>";
  }

  $event->return = str_replace("</head>", $tags . "</head>", $event->return);

});

以上是关于php Processwire分页的主要内容,如果未能解决你的问题,请参考以下文章

php ProcessWire Mail

php ProcessWire管理数据表

php Processwire更改页面创建日期

php Processwire页面URL挂钩

php Processwire表格

php Processwire Google Analytics跟踪