Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 07-16-2009, 07:54 PM
Tim Skellett Tim Skellett is offline
 
Join Date: Sep 2005
Posts: 73
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Quick question about vBulletin coding and syntax

Hi all,

can I use as a variable in a template:

$vbphrase[$thread[prefix_plain]]

In other words, the resultant should look like this when parsed:

$vbphrase[NAME]

where NAME = $thread[prefix_plain]

Or do I need to add quotemarks or something?
Many thanks in advance for all assistance!
Reply With Quote
  #2  
Old 07-16-2009, 08:01 PM
Gio~Logist's Avatar
Gio~Logist Gio~Logist is offline
 
Join Date: Jun 2004
Location: San Francisco
Posts: 2,575
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have absolutely no no idea what is is you're trying to do. For phrases, the only time you need additional values is when parameters are added.

For example, you'll see a phrase like:
HTML Code:
{1} has no idea what {2} is talking about
And so in the template I would put
HTML Code:
<phrase 1="Gio~Logist" 2="Tim Skellet">$vbphrase[no_idea]</phrase>
Hope that helps
Reply With Quote
  #3  
Old 07-16-2009, 08:11 PM
Tim Skellett Tim Skellett is offline
 
Join Date: Sep 2005
Posts: 73
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll try making it clearer.

I want to call a Phrase from within a template.

Therefore,

$vbphrase[name]

Now, the name of the vbphrase that I want to call up is determined by the variable:

$thread[prefix_plain]

So, I want to know, if I can write in a template:

$vbphrase[$thread[prefix_plain]]

Or if it has to be written differently.

______________

ETA:

Sorry, I used $thread[prefix_rich] in my OP when I meant $thread[prefix_plain]
Reply With Quote
  #4  
Old 07-16-2009, 08:31 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well the obvious answer is just try it

You may have to put it inside curly brackets i.e. {$vbphrase[$thread[prefix_plain]]}
Reply With Quote
  #5  
Old 07-16-2009, 08:43 PM
Tim Skellett Tim Skellett is offline
 
Join Date: Sep 2005
Posts: 73
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M View Post
Well the obvious answer is just try it

You may have to put it inside curly brackets i.e. {$vbphrase[$thread[prefix_plain]]}
Thanks, will try it and will keep curlies in mind!

--------------- Added [DATE]1247783972[/DATE] at [TIME]1247783972[/TIME] ---------------

Tried it, in a variety of ways.

Putting the whole statement, as with also the sub-variable, in curly brackets gets vBulletin to accept the statement, otherwise it is rejected as a malformed conditional.

However, while the code is accepted, it does not give any results, in other words nothing at all shows.

IOW:

{$vbphrase[$thread[prefix_plain]]}

will be accepted by the vB, but then results in nothing being displayed for it. Yes, the Phrases are already there to be called upon, so it's not a case of not displaying because of missing stuff.

Any ideas, anyone?
Reply With Quote
  #6  
Old 07-17-2009, 06:06 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

IIRC, vBulletin does not like an array key than it part of an array in templates. It just doesn't work properly.
Reply With Quote
  #7  
Old 07-17-2009, 08:33 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try: $vbphrase[{$thread[prefix_plain]}]
Reply With Quote
  #8  
Old 07-17-2009, 06:07 PM
Tim Skellett Tim Skellett is offline
 
Join Date: Sep 2005
Posts: 73
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, but this one also returns "Malformed conditional". Tried it again in a variety of ways, either an empty array or a malformed conditional results.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:47 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.04195 seconds
  • Memory Usage 2,224KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_html
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete