gotcha
Site Admin


Joined: Oct 25, 2004
Posts: 754
|
Posted:
Sat Mar 17, 2007 2:53 pm |
|
This will show you how to get forum topic titles into your Google Tapped links. The rewrites are based on the last GT-nextgen release and may need modification for other versions. Backup your files before making any changes.
Files to edit: 4
Difficulty: Easy
Open -> modules/Forums/nukebb.php
Find:
| php: |
include("header.php");
|
After, ADD on a new line:
| php: |
function gt_url($url_in)
{
$url_in = trim(str_replace(array('exec', 'union', '.'), '', $url_in));
$url_out = preg_replace('/[^a-z0-9_\-\.]/i', '_', $url_in);
unset($url_in);
return preg_replace('/[_]{2,}/', '_', $url_out);
}
|
End -> modules/Forums/nukebb.php
_______________________________________
Open -> modules/Forums/viewforum.php
Find:
| php: |
$goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j") . '">' . $times . '</a>';
|
Change to:
| php: |
$goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j&title=".gt_url($topic_rowset[$i]['topic_title'])) . '">' . $times . '</a>';
|
Find:
| php: |
$view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");
|
Change to:
| php: |
$view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&title=".gt_url($topic_rowset[$i]['topic_title']) );
|
Find:
| php: |
$last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $topic_rowset[$i]['topic_last_post_id']) . '#' . $topic_rowset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';
|
Change to:
| php: |
$last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $topic_rowset[$i]['topic_last_post_id']) .'&title='.gt_url($topic_rowset[$i]['topic_title']) . '#' . $topic_rowset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';
|
End -> modules/Forums/viewforum.php
_______________________________________
Open -> .htaccess
Add the following 3 rewrite rules to your forum section:
| Code: |
RewriteRule ^ftopic-([0-9]*)-([0-9]*)-([A-Za-z0-9_-]*).html modules.php?name=Forums&file=viewtopic&t=$1&start=$2&title=$3 [L]
RewriteRule ^ftopic(t|p)-([0-9]*)-([A-Za-z0-9_-]*).html modules.php?name=Forums&file=viewtopic&$1=$2&title=$3 [L]
RewriteRule ^ftopic(t|p)-([0-9]*)-([A-Za-z0-9_-]*).html#([0-9]*) modules.php?name=Forums&file=viewtopic&$1=$2&title=$3#$4 [L]
|
End -> .htaccess
_______________________________________
Open -> GoogleTap/GT-Forums.php
Insert the lines marked in the code below:
This is only part of the $urlin array...
| php: |
$urlin = array(
"'(?<!/)modules.php\?name=Forums&file=viewtopic&t=([0-9]*)&start=([0-9]*)&postdays=([0-9]*)&postorder=(desc|asc)&highlight=([A-Za-z0-9_-]*)'",
"'(?<!/)modules.php\?name=Forums&file=viewtopic&t=([0-9]*)&postdays=([0-9]*)&postorder=(desc|asc)&start=([0-9]*)'",
"'(?<!/)modules.php\?name=Forums&file=viewtopic&t=([0-9]*)&start=([0-9]*)&title=([a-zA-Z0-9-_]*)'",//add#1
"'(?<!/)modules.php\?name=Forums&file=viewtopic&t=([0-9]*)&start=([0-9]*)'",
"'(?<!/)modules.php\?name=Forums&file=viewtopic&t=([0-9]*)&view=(previous|next)'",
"'(?<!/)modules.php\?name=Forums&file=viewtopic&(t|p)=([0-9]*)&highlight=([A-Za-z0-9_-]*)'",
"'(?<!/)modules.php\?name=Forums&file=viewtopic&t=([0-9]*)&(watch|unwatch)=topic&start=([0-9]*)'",
"'(?<!/)modules.php\?name=Forums&file=viewtopic&(t|p)=([0-9]*)((\")|(&sid=[a-zA-Z0-9]*))'",
"'(?<!/)modules.php\?name=Forums&file=viewtopic&(t|p)=([0-9]*)#([0-9]*)((\")|(&sid=[a-zA-Z0-9]*))'",
"'(?<!/)modules.php\?name=Forums&file=viewtopic&(t|p)=([0-9]*)&title=([a-zA-Z0-9-_]*)((\")|(&sid=[a-zA-Z0-9]*))'", // add#2
"'(?<!/)modules.php\?name=Forums&file=viewtopic&(t|p)=([0-9]*)&title=([a-zA-Z0-9-_]*)#([0-9]*)((\")|(&sid=[a-zA-Z0-9]*))'", // add#3
"'(?<!/)modules.php\?name=Forums&file=profile&mode=editprofile'",
"'(?<!/)modules.php\?name=Forums&file=profile&mode=viewprofile&u=([0-9]*)'",
|
This is only part of the $urlout array...
| php: |
$urlout = array(
"ftopic-\\1-\\2-days\\3-order\\4-\\5.html",
"ftopic-\\1-days\\2-order\\3-\\4.html",
"ftopic-\\1-\\2-\\3.html",//add#1
"ftopic-\\1-\\2.html",
"ftopic-\\1-\\2.html",
"ftopic\\1-\\2-\\3.html",
"ftopic-\\1-\\2-\\3.html",
"ftopic\\1-\\2.html\\3",
"ftopic\\1-\\2.html#\\3\\4",
"ftopic\\1-\\2-\\3.html\\4",//add#2
"ftopic\\1-\\2-\\3.html#\\4\\5",//add#3
"forum-editprofile.html",
"forum-userprofile-\\1.html",
|
Save and close all files.
End Mod.
Check out this post to find out how to get the forum name into the url:
http://nukecoder.com/ftopict-367-Forum_Name_in_URL_with_Google_Tap.html |
| |
|