Zblog的Lucky模板TKD优化

zblog教程 2020-08-27

下述代码优化了Lucky模板中的Header.php和Photo.php的TKD,本文作为本人备份用途。

  {if $zbp->Config('Lucky')->seo=="b"}

  {$name}|{$subname}

  {else}



  {if $type=="index"}{$name}|{$subname}

  {elseif $type=="category"&&$page=="1"}{$category.Name}

  {if $category.Metas.XF_Addtitle}-{$category.Metas.XF_Addtitle}{/if}-{$name}

  {elseif $type=="category"&&$page>"1"}{$category.Name}{if $category.Metas.XF_Addtitle}-{$category.Metas.XF_Addtitle}{/if}-{$name}-第{$page}页

  {elseif $type=="tag"&&$page=="1"}{$tag.Name}{if $tag.Metas.XF_Addtitle}-{$tag.Metas.XF_Addtitle}{/if}-{$name}

  {elseif $type=="tag"&&$page>"1"}{$tag.Name}{if $tag.Metas.XF_Addtitle}-{$tag.Metas.XF_Addtitle}{/if}-{$name}-第{$page}页

  {elseif $type=="date"&&$page=="1"}{$title} {$name}{elseif $type=="date"&&$page>"1"}{$title} {$name}

  {elseif $type=="article"}{$title}{if $article.Metas.XF_Addtitle}-{$article.Metas.XF_Addtitle}{/if}-{$name}

  {elseif $type=="page"}{$title}{if $article.Metas.XF_Addtitle}-{$article.Metas.XF_Addtitle}{/if}-{$name}{if $zbp->Config('Lucky')->page_subname=="a"}{/if}

  {else}

  {$title}-{$name}

  {/if}



  {if $type=='index'}





  {elseif $type=='page'}

  {if !empty($article->Metas->XF_Keywords)}



  {else}



  {/if}

  {if !empty($article->Metas->XF_Description)}



  {else}

  {php}$description = preg_replace('/[\r\n\s]+/', ' ', trim(SubStrUTF8(TransferHTML($article->Content,'[nohtml]'),135)).'...');{/php}



  {/if}



  {elseif $type=='article'}

  {if !empty($article->Metas->XF_Keywords)}



  {else}



  {/if}

  {if !empty($article->Metas->XF_Description)}



  {else}



  {/if}

  {elseif $type=='category'}

  {if !empty($category->Metas->XF_Keywords)}



  {else}



  {/if}

  {if !empty($category->Metas->XF_Description)}



  {else}



  {/if}

  {elseif $type=='tag'}

  {if !empty($tag->Metas->XF_Keywords)}



  {else}



  {/if}

  {if !empty($tag->Metas->XF_Description)}



  {else}



  {/if}

  {else}





  {/if}

  {/if}

上述代码仅供线下编辑,在实际运用的时候,需要将代码压缩,否则Title会大段空白!

评论 (0)
    Top