Skip to content

Instantly share code, notes, and snippets.

@AgelxNash
Created April 1, 2013 18:11
Show Gist options
  • Save AgelxNash/5286595 to your computer and use it in GitHub Desktop.
Save AgelxNash/5286595 to your computer and use it in GitHub Desktop.
[Evo] Список тегов текущей статьи (Внимание! Необходим сниппет urlencode)
<?php
/**
* TagList
*
* [[TagList? &data=`[*tag*]` &sep=`,` &tpl=`PostTagList` &outSep=`, `]]
*
* PostTagList:
* <a href="/[~11~]?tag=[+encode+]" title="Все статьи с тегом [+tag+]">[+tag+]</a>
*
* @category snippet
* @version 0.1
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
* @author Agel_Nash <Agel_Nash@xaker.ru>
*/
$sep = (isset($sep)) ? $sep : '';
$data = (isset($data) && $data!='' && $sep!='') ? explode($sep,$data) : array($data);
$out=array();
foreach($data as $item){
$item=trim($item);
$out[]=$modx->parseChunk($tpl,array('tag'=>$item,'encode'=>$modx->runSnippet('urlencode',array('input'=>$item))),'[+','+]');
}
return implode((isset($outSep) ? $outSep : ""),$out);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment