Last active
June 7, 2016 21:15
-
-
Save sxidsvit/45b52b5629d4db34337dcbb49ee9f34b to your computer and use it in GitHub Desktop.
Выборка значений TV-параметра из таблицы MODx (А.Петропавловский)
This file contains hidden or 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 | |
| $tvid = 9; | |
| $res = array(); | |
| $temp = array(); | |
| $output = ''; | |
| $q = $modx->newQuery('modTemplateVarResource', array('tmplvarid' => $tvid)); | |
| $q -> select('contentid, value'); | |
| if ($q->prepare() && $q->stmt->execute()) { | |
| while ($row = $q->stmt->fetch(PDO::FETCH_ASSOC)) { | |
| $val = explode(',',$row['value']); | |
| $temp = array_merge($temp, $val); | |
| } | |
| } | |
| $result = array_unique($temp); | |
| foreach ($result as $item) { | |
| $output .= '<li><a href="#" class="'.$item.'">'.$item.'</a></li>'; | |
| } | |
| echo $output; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment