vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   vbphrase inside vbphrase is not possible (https://vborg.vbsupport.ru/showthread.php?t=118540)

emtee 06-14-2006 05:32 AM

vbphrase inside vbphrase is not possible
 
Hi,

I want to have $vbphrase[my_phrase_$DynamicValue] but it's not possible, so I tried to put a $vbphrase inside a parent $vbphrase but it's not possible either. Any workaround for this issue beside using if condition because 100 if conditions certainly don't look good and it can kill your server (evaluate and process hundreds of if conditions)

Example: I have a drop down select box with short description and long description for car makers. Short description is VW and long is VoltsWagen. For main page, because space is limited so I just want VW displayed instead of VoltsWagen, and since only 1 value VW is saved to the column, when I want to display long description VoltsWagen, I use

<if condition="$info[carmaker] == VW">$vbphrase[carmaker_VW]</if>

(of course I have a phrase carmaker_VW contains value VoltsWagen)

which works fine, but I don't like it because if you have hundreds of carmakers (or for other data) then you have to use hundreds if conditions. I don't like having hundreds of if conditions just in 1 template

So I really want something like this: $vbphrase[carmaker_$info[carmaker]]

or $vbphrase[carmaker_$vbphrase[carmaker_VW]]

I also tried <phrase 1="$info[carmaker]">$vbphrase[maker_]</phrase> with a phrase maker_ contains value maker_{1} but it don't work either.



Any help is greatly appreciated!

Alan @ CIT 06-14-2006 05:47 AM

In your PHP script, try:

PHP Code:

$make $vbphrase['carmaker_' $info['carmaker']]; 

See if that works.

Thanks,
Alan.

emtee 06-15-2006 12:12 AM

I'm trying to do it in templates only though. If it's impossible to do in templates then I'll add it to my PHP script.

Thanks Alan for helping! :)

Adrian Schneider 06-15-2006 02:31 AM

Use
Code:

{$vbphrase['carmaker_' . $info['carmaker']]}
in your template.

emtee 06-15-2006 04:01 AM

SirAdrian,
It works! Thank you very much! :banana:


All times are GMT. The time now is 03:49 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.00992 seconds
  • Memory Usage 1,717KB
  • 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_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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