vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Build Post URL from PostID (https://vborg.vbsupport.ru/showthread.php?t=282901)

DivinoZarathos 05-14-2012 01:10 PM

Build Post URL from PostID
 
Hi all!
I'm working on a FORUMDISPLAY modification. I want to add an icon to every threadbit with a link to a post that is on another thread (which is maybe on another forum also). How can I achieve that if I can only use PostID? Is "showthread.php?p=PostID" enough even if the post is located in another thread/forum?
How can I build such a link using fetch_seo_url function or "vb:link thread" without specifying a threadinfo? I'm just trying to avoid adding a very loud query like fetch_threadinfo of fetch_postinfo to just recover external threadid/title for every threadbit I have to process... :confused:

Thanks!

kh99 05-14-2012 01:32 PM

showthread.php?p=PostID works, but it seems to scroll you to the given post instead of showing the top of the thread. But if you want the seo url then I suppose there's no way to avoid having to get the thread title.

DivinoZarathos 05-14-2012 01:33 PM

Uh ok! So I'll put something like:
showthread.php?p={vb:raw myvar.mypostid} in my template right?

kh99 05-14-2012 01:35 PM

If myvar.mypostid gives you the post id, then it look OK to me. Of course you can always see if it works the way you want by entering a url in your browser.

DivinoZarathos 05-14-2012 01:44 PM

Mhhhh... do you also know how to check if a post still exists from PostID?
I was just thinking about what can happen if the linked post is being deleted...

kh99 05-14-2012 01:54 PM

You could call fetch_postinfo(postid), check if the return is an array, then check 'isdeleted' to see if it has been deleted. But of course that requires a query (you can see the code for fetch_postinfo() in includes/functions.php).

DivinoZarathos 05-14-2012 08:02 PM

Thank you!


All times are GMT. The time now is 07:51 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00935 seconds
  • Memory Usage 1,714KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete