Участник+


Зарегистрирован: Mar 2003
Место проживания: Барнаул, Россия
Публикаций: 1169
Статус: ![he][es в оф-лайне](images/offline.gif) |
Я позаимствовал в IPB такой кусочек:
PHP:
function site_header($site_body) {
global $INFO, $mysql_driver, $result, $show, $navigation, $site_body, $site_head, $site_bottom;
$site_body .="";
$query_str = "SELECT * FROM miss_templates WHERE tmpl_id='1'";
$mysql_driver->select_from_mysql($query_str);
list($tmpl_id, $template_text, $tmpl_name) = mysql_fetch_row($result);
$template_text = str_replace( "<% BOARD HEADER %>" , $site_head , $template_text);
$template_text = str_replace( "<% BOTTOM %>" , $site_bottom , $template_text);
$template_text = str_replace( "<% TITLE %>" , $INFO['site_title'] , $template_text);
$template_text = str_replace( "<% META-KEYS %>" , "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=koi8-r\">\n".$this->meta , $template_text);
$template_text = str_replace( "<% CSS %>" , "<link REL=\"StyleSheet\" HREF=\"css.css\" TYPE=\"text/css\">" , $template_text);
$template_text = str_replace( "<% JAVASCRIPT %>" , $this->java , $template_text);
$template_text = str_replace( "<% NAVIGATION %>" , "<table class=\"navigation\"><tr><td>Навигация</td><td><a href=\"".$INFO['site_url']."index.php?act=show_all_miss\">Показать всех мись</a></td></tr><tr><td colspan=\"2\">".$navigation->navigator()."</td></tr></table>" , $template_text);
$show->miss_id = mt_rand(1, $show->max_nom('miss'));
$show->how_show = "short";
$template_text = str_replace( "<% SHOW MISS %>" , "<table><tr><td>".$show->show_miss()."</td></tr></table>" , $template_text);
$template_text = str_replace( "<% STATS %>" , "<table align=\"center\"><tr><td>News: ".$show->show_news()."</td></tr></table>" , $template_text);
$template_text = str_replace( "<% COPYRIGHT %>" , "<table class=\"copyrights\" width=\"80%\" align=\"center\" cellpadding=\"3\" cellspacing=\"0\"><tr><td align=\"center\" valign=\"middle\" class=\"copyright\">COPYRIGHT: ".$INFO['copyrights']." </td></tr></table>" , $template_text);
$template_text = str_replace( "<% BOARD %>" , "<table class=\"main\" width=\"100%\" align=\"center\"><tr><td>".$site_body."</td></tr></table>" , $template_text);
echo $template_text;
}
Переменная $site_head содержит файл прочтенный до этого, воот собствено вопрос, как заменить содержащиеся в этой переменные на их значения?
__________________
Админ - вождь Апачей...
Сообщить модератору об этом сообщении | Предупреждение | IP: определен
|