The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
vBulletin 4 Template Syntax: Links
This article was created by Freddie Bingham on vB.com and reposted here with his permission: In vBulletin 4.0, we will support friendly URL for SEO and readability purposes. At the present, we support member, thread, and forum links. I expect that this list will grow to include albums, etc before the release date. You need to be aware of the new format for outputting these urls. TEMPLATES When you wish to use a url in a template the format is as follows: Code:
{vb:link string, array[, array][, string, string]} {vb:link [thread|member|forum], $threadinfo[, $pageinfo][, id, title]} The second argument is a string that notifies the system which type of URL is to be output. The valid types are thread, forum, and member The third argument is an array that contains the id and title, at minimum, of the link to be generated. For thread, this would be threadid and title. For forum this would be forumid and title. For member this would be userid and username. The fourth argument is an optional array that contains any arguments that are required to be sent along, such as perpage (pp), page (pagenumber), order, and so on. The simplest forms are: Code:
{vb:link thread, {vb:raw threadinfo}} {vb:link forum, {vb:raw foruminfo}} {vb:link member, {vb:raw userinfo}} Code:
{vb:link thread, {vb:raw post}, null, 'threadid', 'threadtitle'} If you wish to output a url that uses & instead of & for arguments, for javascript, append "|js" to your type argument so that thread becomes thread|js, member becomes member|js. If you wish to not output a sessionhash, in any instance, say for a url in an email, append nosession to the type argument, so that thread becomes thread|nosession EXAMPLES To output a link to a post, you could use HTML Code:
<a href="{vb:link thread, $threadinfo, $pageinfo_lastpost}#post$lastpostinfo[lastpostid]">$threadinfo[title]</a> PHP Code:
When creating a link in the code, use the fetch_seo_url function, which accepts the same arguments. function fetch_seo_url(string, array, array, string, string) In fact the {vb:link thread, $threadinfo, $pageinfo} syntax is just replaced with fetch_seo_url() when a template is compiled. EXAMPLES Infractions tab of a user's profile PHP Code:
Please be aware of this change and use it as needed in 4.0. Please refer to the code for exact examples if I have just confused you. |
#2
|
||||
|
||||
Thanks. I remember having that seen before, but I did not remember where.
The mod I have converted mainly has links to groups. In the quote linked by Dismounted Freddie hints that he expects that other forms of content would be added as development progresses. I'll ask over at .com whether that is indeed the case (or has anyone already done so?). Ok, I just tried coming to grips with the linking function trying with the one link (to a members profile) that is eligible in this mod. So I totally failed with that. Looking at the code did'nt help me here, either. Perhaps anyone would be willing to enlighten me? What I have is the username and the userid in an array that contains more data. $example['usernane'] and $example['userid']. What would the code have to look like if I wanted to that users profile? |
#3
|
||||
|
||||
PHP Code:
|
#4
|
||||
|
||||
Ah - just not as easy
What messed me up so badly was the mixup of the new link method and the new way to pass variables to phrases, although thats pretty straightforward - once one sees through it. What I needed was: Code:
{vb:rawphrase by_x {vb:link member, {vb:raw example}, null, 'lastposterid', 'lastposter'}, {vb:var example.lastposter}} |
#5
|
|||
|
|||
Hello, I'm having a trouble.
I'm currently using vBulletin 4.2, and I want to generate a template link to a generic post (it depends on the post)... So, I use this code (that I get from postbit template): Code:
{vb:link thread, {vb:raw thread}, {vb:raw pageinfo_post}}#post{vb:raw post.postid} http://mypage.com/showthread.php?X-Thread-Title#p=YYY Where X is the thread id and YYY is the post id, but, the link should be something like: http://mypage.com/showthread.php?X-T...le&p=YYY#p=YYY Anyone knows what could it be? Thanks in advance =D... |
#7
|
|||
|
|||
Is a plugin that is added to the user info... Is for giving Like / Dislikes to posts...
That must be it... Is there another way to get the post link then?.. Thank You for your time by the way =D... |
#8
|
|||
|
|||
Well, if you have a plugin I think you can just create your own array and register it to your template, like:
Code:
$pageinfo_post = array( 'p' => $postid ); Then if your plugin is rendering the template, call register('pageinfo_post', $pageinfo_post) before the call to render(). If you're putting that in an exitsing template, then you need ti call preRegister instead, like Code:
vB_Template::preRegister('template_name', array('pageinfo_post' => $pageinfo_post)); |
#9
|
|||
|
|||
Do someone knows how to get the link to someones user's profile picture?? I am trying to do a widget that shows the picture of the logged in user with a hello message... but cannot find how to display the user's avatar or profile picture.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|