MyBB Community Forums

Full Version: What is the Algorithm of SEF URL?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to fetch a specific post from mybb_posts table and want to display url of that post. Currently I am using this method:
echo " <a href='http://www.example.com/showthread.php?tid=". $row[tid] ."&pid=". $row[pid] ."#pid". $row[pid] ."' target='_blank' class='linkstyle'>";
	echo $row[subject] ."</a><br>";

This is working fine for normal urls, But how to do it when forum is gzip compresed. In this case URLs are:
http://www.example.com/thread-192-post-654.html#pid654

So how do accomplish this task?
I don't understand what gzip compression has to do with urls.

the link would look like:
http://www.example.com/thread-". $row[tid] ."-post-". $row[pid] .".html#pid". $row[pid] ."

Just keep in mind that's just a rough guess but it should work.
Use the get_thread() function.
http://www.example.com/thread-192-post-654.html#pid654

Thread ID
Post ID
get_post_link($pid, $tid=0) ?
Thankx guys solved Big Grin
btw what are the arguments of get_thread() function?
(2011-08-01, 06:55 PM)sunjava1 Wrote: [ -> ]Thankx guys solved Big Grin
btw what are the arguments of get_thread() function?

/**
4870   * Get the thread of a thread id.
4871   *
4872   * @param int The thread id of the thread.
4873   * @param boolean Whether or not to recache the thread.
4874   * @return string The database row of the thread.
4875   */
4876  function get_thread($tid, $recache = false)

In the future, use this extremely useful tool: http://crossreference.mybboard.de/nav.ht...index.html

It's well worth a bookmark.
look for get_*_link() in inc/functions.php, in your case I guess get_post_link($pid, $tid).

It does not actually return the #pid{$pid} part so you have to append that yourself...


gzip compression does not matter whatsoever