51ff3226 |
1 | <?php |
2 | function smarty_function_get_children_by_external_link($params,&$smarty) { |
3 | global $db,$node; |
4 | |
5 | if ($params['orderby']=='desc') $orderby="desc"; |
6 | $external_link=$params['external_link']; |
7 | |
8 | if ($params['listing_amount']=='all') $listing_amount='23232323232323323'; |
9 | else $listing_amount=$params['listing_amount']; |
10 | |
11 | if (empty($params['offset'])) $offset=0; |
12 | else $offset=$params['offset']; |
13 | |
14 | if (empty($params['orderby_type'])) $orderby_type = 'node_created'; |
15 | else $orderby_type = $params['orderby_type']; |
16 | |
17 | // if (!$params['parent_id']) { |
18 | $parent_id=$node['node_id']; |
19 | // } |
20 | // else $parent_id=$params['parent_id']; |
21 | |
22 | $user_id=$_SESSION['user_id']; |
23 | |
24 | $q="select users.*,nodes.* from nodes left |
25 | join users on users.user_id=nodes.node_creator where node_parent='$parent_id' |
26 | and external_link='$external_link' order by $orderby_type $orderby LIMIT $offset,$listing_amount"; |
27 | |
28 | $set=$db->query($q); |
29 | while ($set->next()) $pole[]=$set->getRecord(); |
30 | $smarty->assign('get_children_by_external_link',$pole); |
31 | } |
32 | ?> |