| 1 | <?php |
| 2 | |
| 3 | function smarty_function_get_children_by_external_link($params,&$smarty) { |
| 4 | |
| 5 | if ($params['orderby']=='desc') $orderby="desc"; |
| 6 | |
| 7 | $external_link=$params['external_link']; |
| 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 | $user_id=$_SESSION['user_id']; |
| 21 | |
| 22 | $q="select users.*,nodes.*,node_content.* from nodes left join |
| 23 | node_content on (node_content.node_id=nodes.node_id) left |
| 24 | join users on users.user_id=nodes.node_creator where node_parent='$parent_id' |
| 25 | and external_link='$external_link' order by node_created $orderby LIMIT $offset,$listing_amount"; |
| 26 | |
| 27 | $set=$db->query($q); |
| 28 | while ($set->next()) $pole[]=$set->getRecord(); |
| 29 | $smarty->assign('get_children_by_external_link',$pole); |
| 30 | } |
| 31 | ?> |