I have faced a problem that when I set up the phpBB SEO in mixed mode, all my topics do not have any URL, obviously.
Thus, all of them are shown as /forum-URL/topic#####.html
which is good, but not good enough for me.
Question1:
Can I make phpBB SEO rewrite all topic-URL accoding to Subjects of topics translating and modifying them as necessary (as set up in setup_phpbb_seo.php)?
Only if the topic URL is not set manually.
SQL rewrite is ON.
----
Temporarily I did the following:
1) Hide URL field from non-moderators
It is said in the phpBb SEO ACP that SQL rewiting is available to moderators and admins only, but it is not as I can see from the template. My patch hides the URL field from non-moderators.
in template subsilver2 posting_body.html I show URL field only to moderators. So, users can't set or edit topic URL - it shoudl be generated automatically. While moderators can do it manually.
- Code: Select all
<!-- IF S_URL and U_MCP -->
<tr>
<td class="f" colspan="3">
<b class="genmed">URL:</b>
<input class="post" style="width:450px" type="text" name="url" size="45" maxlength="250" tabindex="2" value="{TOPIC_URL}" />
</td>
</tr>
<!-- ENDIF -->
I had to modify posting.php to pass U_MCP to the template:
- Code: Select all
$template->assign_vars(array(
'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id&start=$start" . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '',
2) Setting good default URL for new topics
If the topic URL remains empty after editing, it is generated automatically from the Subject. Since my forum is in Russian, all national symbols are translated into latin characters.
- Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
if (!empty($phpbb_seo->seo_opt['sql_rewrite'])) {
if ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_id)) {
$phpbb_seo->set_url($post_data['forum_name'], $forum_id, $phpbb_seo->seo_static['forum']);
$_parent = $post_data['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$forum_id];
$_t = !empty($post_data['topic_id']) ? max(0, (int) $post_data['topic_id'] ) : 0;
//Added by Versus - start
// Overriding empty URL fields
if ($_REQUEST['url']==''){$_REQUEST['url']=$_REQUEST['subject'];}
//Added by Versus - end
// next line is amended by Versus
$_url = $phpbb_seo->url_can_edit($forum_id) ? utf8_normalize_nfc(request_var('url', '', true)) : ( isset($post_data['topic_url']) ? $post_data['topic_url'] : utf8_normalize_nfc(request_var('url', '', true)) );
if (!$phpbb_seo->check_url('topic', $_url, $_parent)) {
if (!empty($_url)) {
// Here we get rid of the seo delim (-t) and put it back even in simple mod
// to be able to handle all cases at once
$_url = preg_replace('`' . $phpbb_seo->seo_delim['topic'] . '$`i', '', $_url);
$_title = $phpbb_seo->get_url_info('topic', $_url . $phpbb_seo->seo_delim['topic'] . $_t);
} else {
$_title = $phpbb_seo->modrtype > 2 ? censor_text($post_data['post_subject']) : '';
}
unset($phpbb_seo->seo_url['topic'][$_t]);
$_url = $phpbb_seo->get_url_info('topic', $phpbb_seo->prepare_url( 'topic', $_title, $_t, $_parent , (( empty($_title) || ($_title == $phpbb_seo->seo_static['topic']) ) ? true : false)), 'url');
unset($phpbb_seo->seo_url['topic'][$_t]);
}
$post_data['topic_url'] = $_url;
}
}
// www.phpBB-SEO.com SEO TOOLKIT END
What do you say?
Is it good?
Any other good solution for that?

English |
French
