vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Current URL inside Hyperlink (https://vborg.vbsupport.ru/showthread.php?t=245281)

Speedy2000 06-25-2010 05:00 PM

Current URL inside Hyperlink
 
I'm basically attempting to create a 'share to Twitter'-button. It uses this code:
HTML Code:

<a href="http://twitter.com/home?status=Currently reading http://www.website.com/postx" title="Click to send this page to Twitter!" target="_blank">Share on Twitter</a>
Now I want the code to automatically insert the current URL (of the current thread) (replacing the www.website.com/postx).

Because I have vbSEO installed, I tried to use the variable $_SERVER[VBSEO_URI] (but also the original vBulletin variable http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]). But apparently the link doesn't translate any of those variables into actual links. Maybe because the variable is placed inside the quotation marks.

Is there a way to have it properly translate the variable to a usable URL?

Rafa-el 06-25-2010 09:10 PM

Try with this:
PHP Code:

<a href="http://twitter.com/home/?status=http://www.forum.com/{vb:link thread, {vb:raw thread}, {vb:raw pageinfo_post}}#post{vb:raw post.postid}" target="_blank">
<
img src="http://www.forum.com/images/bookmark/twitter_32.png" alt="Share in twitter" style="border-style: none"/>
</
a

This will share the current post link and will be converted to vBSEo links as well.

I've included a image wich can be used with this post at 32px but you can use any image that you want.

- Rafael

Speedy2000 06-26-2010 07:50 AM

That's great, thank you very much :)

I've also inserted the Thread Title into the tweet by adding the variable {vb:raw thread.title}. But the URL isn't converted into a vBSEO link, instead it just uses the 'normal' vBulletin links. Does vBSEO have its own variables that I could use?

Rafa-el 06-26-2010 02:13 PM

Yes, vBSEO have it's own variables, take a look at here: http://www.vbseo.com/f2/vbseo-functi...sibility-1662/ so you can check the extensibility.


All times are GMT. The time now is 11:21 PM.

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.01063 seconds
  • Memory Usage 1,719KB
  • 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)bbcode_html_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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