define(array('news_arh' => 'person_archive.tpl')); $tpl->define_dynamic('row', 'news_arh'); $tpl->define_dynamic('page_bar', 'news_arh'); $tpl->assign('PAGE_TITLE', 'Авторы Городка'); $tpl->assign('R_TITLE', 'Список авторов Городка'); $tpl->assign('KEY_WORDS', 'Все авторы Городка список листинг'); $tpl->assign('ROOT_PATH', $rootpath); $cnt = mysql_num_rows ( mysql_query ("SELECT * FROM g_authors where abbr != 'unknown'")); if ($cnt == 0) { $reason = -1; exit (require_once $_SERVER['DOCUMENT_ROOT'].'/chancellery/index.php'); } if (empty ($p)) $p = "0"; $in_page = $cfg ['links_related']; $authors = mysql_query ("SELECT * FROM g_authors where abbr != 'unknown' LIMIT $p, $in_page"); while ($r = mysql_fetch_array ($authors)) { $foto = $r['img_foto'] != '' ? $cfg['img_foto_path'].$r[img_foto] : $cfg['img_foto_path'].'no_foto.jpg'; $comment = get_first_line ($r ['text'], 400, true); $comment = $comment > '' ? $comment : 'нет подробной информации'; $tpl->assign( array( "IMG_FOTO"=> $foto, "N_LINK" => $r ['abbr'] . '/', "N_TITLE" => get_author_name ($r['abbr']), "N_COMMENT" => $comment, "NEWS" => is_works ($r ['abbr'], 'a_news_db') ? 'да' : 'нет', "READ" => is_works ($r ['abbr'], 'a_read_db') ? 'да' : 'нет', "LOOK" => is_works ($r ['abbr'], 'a_look_db') ? 'да' : 'нет', "HEAR" => is_works ($r ['abbr'], 'a_hear_db_worklist') ? 'да' : 'нет' ) ); $tpl->parse ('ft_news_arh', '.row'); } // Навигационная строка $pages = pagebar_link ($cnt, $in_page, $p, ''); if ($pages == "") { $tpl->clear_dynamic('page_bar'); }else{ // error_log ('before SELECT - fixed', 'php://stderr', 3); // из-за обратной очередности следующих двух строк страница выводилась верно, // но FastTemplate писал Warning: no value found for variable: {SELECT} $tpl->assign('SELECT', $pages); $tpl->parse ('ft_body', '.page_bar'); } $tpl->assign('ARCHIVE', $where); $tpl->parse('ft_head', 'head'); $tpl->parse('ft_foot', 'foot'); $tpl->parse('ft_news_arh', 'news_arh'); $tpl->FastPrint('ft_head'); $tpl->FastPrint('ft_news_arh'); $tpl->FastPrint('ft_foot'); exit; // ВЫХОД !!! } else { // isset ($abbr) - new link mode $abbr = eregi_replace ('/', '', $abbr); $filter = "WHERE abbr='$abbr'"; } } else { // isset ($id) - old link mode $id = eregi_replace ('/', '', $id); $filter = "WHERE id='$id'"; } $tpl -> define (array ('body' => 'person.tpl')); $auth = mysql_query ('SELECT * FROM g_authors ' . $filter); if (mysql_num_rows ($auth)==0) { $reason = 204; exit (require_once $_SERVER['DOCUMENT_ROOT'].'/chancellery/index.php'); } $a = mysql_fetch_array ($auth); $tpl->assign ('PAGE_TITLE', 'Персоналии: ' . $a ['title']); $tpl->assign ('KEY_WORDS', 'персоналии авторы информация подробно ' . htmlspecialchars ($a ['title'])); $tpl->define_dynamic('row', 'body'); $tpl->define_dynamic('is_topics', 'body'); // ************************************************************************ function fill_row ($title, $table, $rootpath, $ab) { global $tpl, $where, $cfg; // echo '[', $title, ']'; $where[] = $title; $lasta = get_last_article ($table, $ab); // test: echo $lasta [title]; $lasta_title = $lasta ['title'] > '' ? $lasta ['title'] : get_first_line ($lasta ['text']); if ( count ($lasta ['id']) > 0) { $tpl->assign( array( "RAZD_NAME"=> $title, "RAZD_LINK"=> $rootpath, "N_TITLE" => stripslashes ($lasta_title), "N_LINK" => $rootpath . $lasta ['id'] . '/', "N_COMMENT"=> get_first_line ($lasta ['text'], $cfg ['trunc_title'] - strlen ($lasta_title), false), "N_ALL" => num_rows ($table, $ab) ) ); $tpl->parse ('ft_body', '.row'); } else { $tpl->assign( array( "RAZD_NAME"=> '', "RAZD_LINK"=> '', "N_TITLE" => '', "N_LINK" => '', "N_COMMENT"=> '', "N_ALL" => '' ) ); } } // **** $is_news = is_works ($a ['abbr'], 'a_news_db'); $is_look = is_works ($a ['abbr'], 'a_look_db'); $is_hear = is_works ($a ['abbr'], 'a_hear_db_worklist'); $is_read = is_works ($a ['abbr'], 'a_read_db'); if (($is_news || $is_look || $is_hear || $is_read) == false) { $where = array ('(нет публикаций)'); $tpl->clear_dynamic ('row'); $tpl->clear_dynamic ('is_topics'); }else{ $where = array (); // echo $a[abbr]; if ($is_news) { fill_row ('Новости', 'a_news_db', '/news/', $a ['abbr']); } if ($is_look) { fill_row ('Смотрим', 'a_look_db', '/look/', $a ['abbr']); } if ($is_hear) { fill_row ('Слушаем', 'a_hear_db_worklist', '/hear/', $a ['abbr']); } if ($is_read) { fill_row ('Читаем' , 'a_read_db', '/read/', $a ['abbr']); } } // ************************************************************************ if ($a ['img_foto'] == '') { $foto = 'no_foto.jpg'; $falt = 'Здесь могла бы быть НАША реклама ;)'; }else{ $foto = $a ['img_foto']; $falt = $a ['title']; } $tpl->assign( array( "TITLE" => $a ['title'], "F_LINK"=> $cfg ['img_foto_path'] . $foto, "F_ALT" => $falt, "TEXT" => nl2br ($a ['text']), "ALSO" => 'Публикации в разделах: ' . implode (', ', $where) . '.' ) ); $tpl->parse('ft_head', 'head'); $tpl->parse('ft_body', 'body'); $tpl->parse('ft_foot', 'foot'); $tpl->FastPrint ('ft_head'); $tpl->FastPrint ('ft_body'); $tpl->FastPrint ('ft_foot'); ?>