Commit | Line | Data |
---|---|---|
51ff3226 | 1 | <? |
2 | function smarty_function_get_banner(&$smarty) { | |
3 | $banners_directory = $_SERVER['DOCUMENT_ROOT']."/banners/"; | |
4 | ||
5 | $handle = opendir($banners_directory); | |
6 | while (false !== ($target = readdir($handle))) { | |
7 | if ($target != "." && $target != "..") { | |
8 | list($name, $ext) = explode(".", $target); | |
9 | if($ext == "swf") { | |
10 | $banners_array[] = $target; | |
11 | } | |
12 | } | |
13 | } | |
14 | ||
15 | $rand = rand(0, count($banners_array) - 1); | |
16 | ||
17 | $smarty->assign('get_banner', $banners_array[$rand]); | |
18 | } | |
19 | ?> |