50 lines
1.7 KiB
PHP
50 lines
1.7 KiB
PHP
|
<?php
|
||
|
/*
|
||
|
модуль отображает список страниц определенной категории
|
||
|
*/
|
||
|
mkdir (MYDIR . '/img/slider/' . ID, 0700);
|
||
|
unset($a);
|
||
|
$a['id']=ID;
|
||
|
$catinfo=$db->get_massiv('page_cat', $a);
|
||
|
//print_r($catinfo);
|
||
|
//$result = mysql_query('SELECT `txt`, `description`, `keywords` FROM `page_cat` WHERE `id` = "' . ID . '" LIMIT 1');
|
||
|
//echo 'SELECT `txt`, `description`, `keywords` FROM `page_cat` WHERE `id` = "' . ID . '" LIMIT 1';
|
||
|
//while ( @$cat_info[] = mysql_fetch_array($result));
|
||
|
@$title = $cat_info[0]['txt'];
|
||
|
@$description = $cat_info[0]['description'];
|
||
|
//print_r($cat_info);
|
||
|
//echo $description;
|
||
|
@$keywords= $cat_info[0]['keywords'];
|
||
|
//$result = mysql_query('SELECT * FROM `pages` WHERE `cat` = "' . ID . '" AND `public`="1"');
|
||
|
unset($a);
|
||
|
$a['cat']=ID;
|
||
|
$a['public']=1;
|
||
|
$cat=$db->get_massiv('pages', $a);
|
||
|
//print_r($cat);
|
||
|
//while ( @$postrow[] = mysql_fetch_array($result));
|
||
|
if ($catinfo[0]['txt']){
|
||
|
$smarty->assign('title', @$catinfo[0]['txt']);
|
||
|
$smarty->assign('description', @$catinfo[0]['description']);
|
||
|
$smarty->assign('keywords', @$catinfo[0]['keywords']);
|
||
|
}else{
|
||
|
//header('HTTP/1.1 404 Not Found');
|
||
|
$smarty->assign('title', 'Категория не найдена');
|
||
|
}
|
||
|
$smarty->assign('list', @$cat);
|
||
|
unset($a);
|
||
|
$a['parent']=ID;
|
||
|
$smarty->assign('child', $db->get_massiv('page_cat', $a));
|
||
|
function list_file ( $dir ) {
|
||
|
if ( $dir [ strlen( $dir ) - 1 ] != '/' )$dir .= '/';
|
||
|
$nDir = opendir( $dir );
|
||
|
while ( false !== ( $file = readdir( $nDir ) ) ){
|
||
|
if ( $file != "." AND $file != ".." ){
|
||
|
if ( !is_dir( $dir . $file ) )$files [] = $file;
|
||
|
}
|
||
|
}
|
||
|
closedir( $nDir );
|
||
|
return $files;
|
||
|
}
|
||
|
$sliders=list_file(MYDIR . '/img/slider/' . ID);
|
||
|
$smarty -> assign( 'sliders', $sliders );
|
||
|
?>
|