| 1 | <?php |
| 2 | function smarty_function_get_creation_by_k($params,&$smarty) { |
| 3 | global $db,$node; |
| 4 | |
| 5 | if ($params['orderby'] == 'asc') $orderby = 'asc'; |
| 6 | else $orderby = 'desc'; |
| 7 | |
| 8 | if ($params['listing_amount'] == 'all') $listing_amount = '232323'; |
| 9 | elseif (is_numeric($params['listing_amount'])) $listing_amount = $params['listing_amount']; |
| 10 | else $listing_amount = DEFAULT_LISTING_AMOUNT; |
| 11 | |
| 12 | if (is_numeric($params['offset'])) $offset = $params['offset']; |
| 13 | elseif (is_numeric($_POST['offset'])) $offset = $_POST['offset']; |
| 14 | else $offset = 0; |
| 15 | |
| 16 | $q = "select users.*,nodes.* from nodes left join users on users.user_id=nodes.node_creator where node_creator = ".$node['node_id']." and k > 0 order by k $orderby LIMIT $offset,$listing_amount"; |
| 17 | $set = $db->query($q); |
| 18 | |
| 19 | while ($set->next()) $array[] = $set->getRecord(); |
| 20 | |
| 21 | $smarty->assign('get_creation_by_k',$array); |
| 22 | } |
| 23 | ?> |