Если у вас возникли проблемы, пожалуйста, дайте мне знать, отправив электронное письмо на evgeniy@y-ea.ru. Спасибо!
День добрый! Меня зовут Евгений. Я IT специалист и web - разработчик.
Email: evgeniy@y-ea.ru
Яловой Евгений
Россия, Краснодар
Данный мануал позволяет настроить ЧПУ для вашей фриланс-биржи. ЧПУ также включает настройки для разделов фрилансеров и работодателей, которые позволяют заменить ссылки типа users/?group=freelancer на freelancers/
Для настройки ЧПУ для фриланс-биржи необходимо первым делом установить плагин URLeditor, который входит в сборку.
1) После этого в директорию plugins/urleditor/presets/ необходимо загрузить пресет-файл с правилами формирования ссылок Скачать его можно отсюда: preset_0.zip
Файл содержит следующий код:
forums m=posts&q=&d= forums/{forums_url_structure()}/page{$d}
forums m=posts&q=* forums/{forums_url_structure()}
forums m=posts&id=* forums/{forums_url_structure()}
forums m=topics&s=&d= forums/{forums_url_structure()}/page{$d}{!$m}
forums m=topics&s=* forums/{forums_url_structure()}{!$m}
forums c=* forums/{$c}
forums * forums
page m=* page?m={$m}
page c=system&al=* {$al}{!$c}
page c=*&al=* {cot_url_catpath()}/{$al}
page c=*&id=* {cot_url_catpath()}/{$id}
page c=* {cot_url_catpath()}
index * {$_path}
plug e=tags&a=pages&t=* {$e}/{$t}{!$a}
plug e=tags&a=*&t=* {$e}/{$a}/{$t}
plug e=* {$e}
users group=employer&cat=* employers/{$cat}/{!$group}
users group=freelancer&cat=* freelancers/{$cat}/{!$group}
users group=employer employers/{!$group}
users group=freelancer freelancers/{!$group}
users m=details&u=* users/{cot_url_username()}
login * {$_area}
message * {$_area}
admin m=* admin/{$m}
admin * {$_area}
rss m=*&c=* {$_area}/{$m}/{$c}
rss m=*&id=* {$_area}/{$m}/{$id}
rss c=* {$_area}/{$c}
rss m=* {$_area}/{$m}
* c=*&al=* {$_area}/{cot_url_catpath()}/{$al}
* c=*&id=* {$_area}/{cot_url_catpath()}/{$id}
* c=* {$_area}/{cot_url_catpath()}
* al=* {$_area}/{$al}
* id=* {$_area}/{$id}
* * {$_area}
В директории system/ создаем файл functions.custom.php (func_0.zip) с кодом функции forums_url_structure() для подключения библиотеки дополнительных функций. Подключить его можно в конфиг-файле datas/config.php Для этого установите переменную $cfg['customfuncs'] в значение true:
$cfg['customfuncs'] = TRUE;
В этом файле должна присутствовать следующая функция:
function forums_url_structure(&$args)
{
global $cfg, $db, $structure, $db_forum_topics, $db_forum_posts;
require_once cot_incfile('forums', 'module');
$script = 'forums';
$replacement = '';
if(isset($args['m']) && $args['m'] == 'topics')
{
if(isset($args['s']))
{
$d = (int) $args['d'];
$replacement .= str_replace('.', '/', $structure['forums'][$args['s']]['path']);
if(isset($args['d']))
{
$replacement .= '/page'.$d;
}
unset($args['d']);
unset($args['s']);
}
else $replacement .= $script;
}
elseif(isset($args['m']) && $args['m'] == 'posts')
{
if(isset($args['q']))
{
$q = (int) $args['q'];
$d = (int) $args['d'];
$s = $db->query("SELECT fp_cat FROM $db_forum_posts WHERE fp_topicid=".$q)->fetchColumn();
$replacement .= str_replace('.', '/', $structure['forums'][$s]['path']).'/topic'.$q;
if(isset($args['d']))
{
$replacement .= '/page'.$d;
}
unset($args['d']);
unset($args['q']);
unset($args['m']);
}
elseif(isset($args['id']))
{
$id = (int) $args['id'];
$s = $db->query("SELECT fp_cat FROM $db_forum_posts WHERE fp_id=".$id)->fetchColumn();
$replacement .= str_replace('.', '/', $structure['forums'][$s]['path']).'/post'.$id;
unset($args['id']);
unset($args['m']);
}
else $replacement .= $script;
}
else $replacement .= $script;
return $replacement;
}
После этого обязательно нужно изменить коневой файл .htaccess :
################ Cotonti Handy URLs for Apache #######################
# Below are the rules to be included in your main .htaccess file or httpd.conf
# Rewrite engine options
Options -Indexes
RewriteEngine On
# Server-relative path to Cotonti. Replace it with your path if you run Cotonti
# in a subfolder
RewriteBase "/"
# Language selector
RewriteRule ^(en|ru|de|nl)/(.*) $2?l=$1 [QSA,NC,NE]
# Sitemap shortcut
RewriteRule ^sitemap\.xml$ index.php?r=sitemap [L]
# Admin area and message are special scripts
RewriteRule ^admin/([a-z0-9]+) admin.php?m=$1 [QSA,NC,NE,L]
RewriteRule ^(admin|login|message)(/|\?|$) $1.php [QSA,NC,NE,L]
# users
RewriteRule ^employers/?$ index.php?e=users&group=employer [QSA,NC,NE,L]
RewriteRule ^freelancers/?$ index.php?e=users&group=freelancer [QSA,NC,NE,L]
RewriteRule ^employers/([a-zA-Z0-9_./%-]+)/?$ index.php?e=users&group=employer&cat=$1 [QSA,NC,NE,L]
RewriteRule ^freelancers/([a-zA-Z0-9_./%-]+)/?$ index.php?e=users&group=freelancer&cat=$1 [QSA,NC,NE,L]
# forums
RewriteRule ^forums/([a-zA-Z0-9_./%-]+)/topic([0-9]+)/page([0-9]+)?$ index.php?e=forums&m=posts&q=$2&d=$3 [QSA,NC,NE,L]
RewriteRule ^forums/([a-zA-Z0-9_./%-]+)/topic([0-9]+)?$ index.php?e=forums&m=posts&q=$2 [QSA,NC,NE,L]
RewriteRule ^forums/([a-zA-Z0-9_./%-]+)/post([0-9]+)?$ index.php?e=forums&m=posts&id=$2 [QSA,NC,NE,L]
RewriteRule ^forums/([a-zA-Z0-9_./%-]+)/([a-zA-Z0-9_%-]+)/page([0-9]+)?$ index.php?e=forums&m=topics&s=$2&d=$3 [QSA,NC,NE,L]
RewriteRule ^forums/([a-zA-Z0-9_./%-]+)/([a-zA-Z0-9_%-]+)/?$ index.php?e=forums&m=topics&s=$2 [QSA,NC,NE,L]
RewriteRule ^forums/([a-zA-Z0-9_%-]+)/?$ index.php?e=forums&c=$1 [QSA,NC,NE,L]
RewriteRule ^forums/?$ index.php?e=forums [QSA,NC,NE,L]
# System category has priority over /system folder
RewriteRule ^system/?$ index.php?rwr=system [QSA,NC,NE,L]
# All the rest goes through standard rewrite gateway
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]+) index.php?rwr=$1 [QSA,NC,NE,L]
Далее в настройках плагина Urleditor необходимо выбрать ваш пресет-файл, который вы создали в пункте 1.
Примечание:
<li<!-- IF {PHP.env.ext} == 'users' AND ({PHP.group} == {PHP.cot_groups.4.alias} AND {PHP.m} == 'main' --> class="active"<!-- ENDIF -->><a href="{PHP.cot_groups.4.alias|cot_url('users', 'group='$this)}">{PHP.cot_groups.4.name}</a></li>
<li<!-- IF {PHP.env.ext} == 'users' AND ({PHP.group} == {PHP.cot_groups.7.alias} AND {PHP.m} == 'main' --> class="active"<!-- ENDIF -->><a href="{PHP.cot_groups.7.alias|cot_url('users', 'group='$this)}">{PHP.cot_groups.7.name}</a></li>
Файлы для скачивания:
Этот мануал раньше был на сайте разработчика биржи, ввиду недоступности ресурса выкладываю у себя.
Новый комментарий