Created
April 1, 2013 18:11
-
-
Save AgelxNash/5286595 to your computer and use it in GitHub Desktop.
[Evo] Список тегов текущей статьи (Внимание! Необходим сниппет urlencode)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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