MyBB Community Forums
What is the Algorithm of SEF URL? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Community (https://community.mybb.com/forum-12.html)
+--- Forum: General Discussion (https://community.mybb.com/forum-11.html)
+---- Forum: Web Development and Administration (https://community.mybb.com/forum-133.html)
+---- Thread: What is the Algorithm of SEF URL? (/thread-100496.html)



What is the Algorithm of SEF URL? - sunjava1 - 2011-08-01

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?


RE: What is the Algorithm of SEF URL? - Alex Smith - 2011-08-01

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.


RE: What is the Algorithm of SEF URL? - faviouz - 2011-08-01

Use the get_thread() function.


RE: What is the Algorithm of SEF URL? - pyridine - 2011-08-01

http://www.example.com/thread-192-post-654.html#pid654

Thread ID
Post ID


RE: What is the Algorithm of SEF URL? - Diogo Parrinha - 2011-08-01

get_post_link($pid, $tid=0) ?


RE: What is the Algorithm of SEF URL? - sunjava1 - 2011-08-01

Thankx guys solved Big Grin
btw what are the arguments of get_thread() function?


RE: What is the Algorithm of SEF URL? - Euan T - 2011-08-01

(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.html?_functions/index.html

It's well worth a bookmark.



RE: What is the Algorithm of SEF URL? - frostschutz - 2011-08-01

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