Commit | Line | Data |
---|---|---|
e586807d H |
1 | <?php |
2 | ||
3 | function smarty_function_get_children_by_type($params,&$smarty) { | |
4 | ||
5 | if ($params['orderby']=='desc') $orderby="desc"; | |
6 | ||
7 | $type=$params['type']; | |
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 | global $db,$node; | |
15 | if (!$params['parent_id']) { | |
16 | $parent_id=$node['node_id']; | |
17 | } | |
18 | else $parent_id=$params['parent_id']; | |
19 | ||
20 | $node_type=$node['node_type']; | |
21 | $user_id=$_SESSION['user_id']; | |
22 | ||
23 | $q="select users.*,nodes.*,node_content.* from nodes left join | |
24 | node_content on (node_content.node_id=nodes.node_id) left | |
25 | join users on users.user_id=nodes.node_creator where node_parent='$parent_id' | |
26 | and template_id='$type' order by node_created $orderby LIMIT $offset,$listing_amount"; | |
27 | ||
28 | $set=$db->query($q); | |
29 | while ($set->next()) $pole[]=$set->getRecord(); | |
30 | $smarty->assign('get_children_by_type',$pole); | |
31 | } | |
32 | ?> |