vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Quick question about vBulletin coding and syntax (https://vborg.vbsupport.ru/showthread.php?t=218756)

Tim Skellett 07-16-2009 07:54 PM

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!

Gio~Logist 07-16-2009 08:01 PM

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 :p

Tim Skellett 07-16-2009 08:11 PM

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]

Paul M 07-16-2009 08:31 PM

Well the obvious answer is just try it ;)

You may have to put it inside curly brackets i.e. {$vbphrase[$thread[prefix_plain]]}

Tim Skellett 07-16-2009 08:43 PM

Quote:

Originally Posted by Paul M (Post 1850136)
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?

Dismounted 07-17-2009 06:06 AM

IIRC, vBulletin does not like an array key than it part of an array in templates. It just doesn't work properly.

Marco van Herwaarden 07-17-2009 08:33 AM

Try: $vbphrase[{$thread[prefix_plain]}]

Tim Skellett 07-17-2009 06:07 PM

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.


All times are GMT. The time now is 03:55 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.01057 seconds
  • Memory Usage 1,727KB
  • 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
  • (2)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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