织梦上一篇下一篇自由可控输出链接、标题、缩略图、时间方法

织梦教程 强烈建议 2024-02-26 11:11 98 0

  在不影响织梦程序原来功能的基础下,织梦二次开发让上一篇下一篇标签自由可控地输出链接、标题、缩略图、时间,没有上一篇或者下一篇时不输出任何东西

  打开 /include/arc.archives.class.php 找到 大概在 735 行左右的

  else if($ctag->GetName()=='fieldlist')复

  在它的 上面 加入

  else if($ctag->GetName()=='prenextdiy')

  {

  $innertext = trim($ctag->GetInnerText());if($innertext)

  {

  $get = $ctag->GetAtt('get');

  $diys['diy'] = $this->GetPreNext('diy');

  $revalue = '';

  $dtp2 = new DedeTagParse();

  $dtp2->SetNameSpace('field','[',']');

  $dtp2->LoadSource($innertext);foreach($diys as $row)

  {foreach($dtp2->CTags as $tid=>$ctag2)

  {if(isset($row[$get][$ctag2->GetName()]))

  {

  $dtp2->Assign($tid,$row[$get][$ctag2->GetName()]);

  }

  }

  $revalue .= $dtp2->GetResult();

  }if($row[$get]['id']) $this->dtp->Assign($i,$revalue);

  }

  }

  如图

  继续找到,大概在852行左右的

  $this->PreNext['pre'] = "上一篇:{$preRow['title']} ";

  在它的 上面 加入

  如图

  继续找到,大概在875行左右的

  $this->PreNext['next'] = "下一篇:{$nextRow['title']} ";

  在它的 上面 加入

  如图

  继续找到,大概在 889 行左右的

  if($gtype=='pre')

  在它的 上面 加入

  if($gtype=='diy')

  {return $this->PreNext['diy'];

  }

  如图

  织梦内容页模板里上一篇下一篇调用标签写法

  上一篇

  {dede:prenextdiy get='pre'}

  

  • 织梦上一篇下一篇自由可控输出链接、标题、缩略图、时间方法

      

    [field:title/]时间:[field:pubdate function="MyDate('Y-m-d',@me)"/]

  • {/dede:prenextdiy}

      下一篇

      {dede:prenextdiy get='next'}

      

  • 织梦上一篇下一篇自由可控输出链接、标题、缩略图、时间方法

      

    [field:title/]时间:[field:pubdate function="MyDate('Y-m-d',@me)"/]

  • {/dede:prenextdiy}

    本站资源均来自互联网或会员发布,如果不小心侵犯了您的权益请与我们联系。我们将立即删除!谢谢!