ну я не проверял как оно работает на субдомене но если нужно реализовать только для форума то тут вроде ничего сложного нету все делаем как Ломби написал(но чуток урезав):
config.php
$cfg['urls_pattern'] = '3'; //1=old, 2=cat/page.html, 3=subdomains, 4=cat/page/
Видимо получим формат ссылок forum.site.com/topic-t1.html
в
system/functions.php после строки
define('SED_GROUP_TOPADMINS', 5);
вставляем строчку
include($cfg['system_dir'].'/functions.custom.php');
создаем файл
functions.custom.php с содержимым:
<php
if (!defined('SED_CODE')) { die('Wrong URL.'); }
function makesafe($text)
{
//$text = preg_replace("#&\#([0-9]*);#ie","_",$text);
$text = html_entity_decode($text);
$text = str_replace(" / ","_",$text);
$text = str_replace("'","",$text);
$text = str_replace("\"","",$text);
$text = str_replace("/","_",$text);
$text = str_replace("'","_",$text);
$text = str_replace(" - ","_",$text);
$text = str_replace("-","_",$text);
$text = str_replace(" ","_",$text);
$text = str_replace( "ä", "ae", $text);
$text = str_replace( "ö", "oe", $text);
$text = str_replace( "ü", "ue", $text);
$text = str_replace( "Ä", "Ae", $text);
$text = str_replace( "Ö", "Oe", $text);
$text = str_replace( "Ü", "Ue", $text);
$text = str_replace( "ß", "ss", $text);
$text = str_replace( "&", "and", $text);
$text = str_replace( "%", "Percent", $text);
$text = str_replace( "ó", "o", $text);
$text = ereg_replace("[^A-Za-z0-9_-]", "", $text);
$text = str_replace("____","_",$text);
$text = str_replace("___","_",$text);
$text = str_replace("__","_",$text);
$text = strtolower($text);
return $text;
}
function cot_category_url(&$args)
{
global $cfg;
$url = parse_url($cfg['mainurl']);
$www = strstr($url['host'], 'www.') ? 'www' : '';
$domain = str_replace('www.', '', $url['host']);
$path = $url['path'];
$patterns = array(
'list.php?c={$c}',
'/{$c}/',
'http://{$c}.{$domain}/',
'/{$c}/'
);
$url = str_replace(array('{$c}', '{$domain}'), array($args['c'], $domain), $patterns[$cfg['urls_pattern'] - 1]);
unset($args['c']);
return $url;
}
function cot_page_url(&$args)
{
global $cfg, $pag, $row, $rpagecat;
$url = parse_url($cfg['mainurl']);
$www = strstr($url['host'], 'www.') ? 'www' : '';
$domain = str_replace('www.', '', $url['host']);
$path = $url['path'];
$patterns = array(
'/page.php?al={$alias}',
'/{$c}/{$alias}.html',
'http://{$c}.{$domain}/{$alias}.html',
'/{$c}/{$alias}/'
);
$page_cat = (!empty($rpagecat) && empty($page_cat)) ? $rpagecat : $page_cat;
$page_cat = (!empty($pag['page_cat']) && empty($page_cat)) ? $pag['page_cat'] : $page_cat;
$page_cat = (!empty($row['page_cat']) && empty($page_cat)) ? $row['page_cat'] : $page_cat;
$url = str_replace(array('{$c}', '{$alias}', '{$domain}'), array($page_cat, $args['al'], $domain), $patterns[$cfg['urls_pattern'] - 1]);
unset($args['al']);
return $url;
}
function cot_forum_section_url(&$args)
{
global $cfg, $fsn, $row, $row1, $master, $title;
$stitle = $title;
$url = parse_url($cfg['mainurl']);
$www = strstr($url['host'], 'www.') ? 'www' : '';
$domain = str_replace('www.', '', $url['host']);
$path = $url['path'];
$title = (!empty($fsn['fs_title'])) ? $fsn['fs_title'] : $row['fs_title'];
$title = (empty($title)) ? $stitle : $title;
$title = (empty($title)) ? $master[1] : $title;
$title = (empty($title)) ? $row1['fs_title'] : $title;
$patterns = array(
'/forums.php?m=topics&q={$id}',
'/forum/{$title}-s{$id}.html',
'http://forum.{$domain}/{$title}-s{$id}.html',
'/forum/{$title}-s{$id}.html'
);
$url = str_replace(array('{$id}', '{$title}', '{$domain}'), array($args['s'], makesafe($title), $domain), $patterns[$cfg['urls_pattern'] - 1]);
unset($args['s'], $master);
return $url;
}
function cot_forum_topic_url(&$args)
{
global $cfg, $fsnn, $fsn, $row, $ft_title;
$url = parse_url($cfg['mainurl']);
$www = strstr($url['host'], 'www.') ? 'www' : '';
$domain = str_replace('www.', '', $url['host']);
$path = $url['path'];
$title = (!empty($fsnn['fs_lt_id'])) ? $fsnn['fs_lt_id'] : $fsn['fs_lt_id'];
$title = (empty($title)) ? $row['ft_title'] : $title;
$title = (empty($title)) ? $ft_title : $title;
$patterns = array(
'/forums.php?m=posts&q={$id}',
'/forum/{$title}-t{$id}.html',
'http://forum.{$domain}/{$title}-t{$id}.html',
'/forum/{$title}-t{$id}.html'
);
$url = str_replace(array('{$id}', '{$title}', '{$domain}'), array($args['q'], makesafe($title), $domain), $patterns[$cfg['urls_pattern'] - 1]);
unset($args['q']);
return $url;
}
function cot_main_urls(&$args, &$spec)
{
global $cfg;
$url = parse_url($cfg['mainurl']);
$www = strstr($url['host'], 'www.') ? 'www' : '';
$domain = str_replace('www.', '', $url['host']);
$path = $url['path'];
$patterns = array(
'/forums.php',
'/forum/',
'http://forum.{$domain}/',
'/forum/'
);
if(empty($args) && $spec['_area'] == 'forums')
{
$url = str_replace(array('{$domain}'), array($domain), $patterns[$cfg['urls_pattern'] - 1]);
}
else
{
$url = $spec['_area'].'.php';
}
return $url;
}
?>
и кладем его в папку
system
в файл
urltrans.dat из папочки
datas вставляем:
forums m=posts&q=* {cot_forum_topic_url()}
forums m=topics&s=* {cot_forum_section_url()}
(это так же можно сделать не вручную а через админку)
ну и напоследок в файле
.htaccess вставляем строки
Тут может я не все строки выкосил(постарался оставить только те которые отвечают за форум) но даже если и так то это ничего страшного на функционирование других частей сайта не должно повлиять
Pavlo Tkachenko aka Dayver