vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Displaying text color in postbit? (https://vborg.vbsupport.ru/showthread.php?t=311417)

Max Taxable 05-17-2014 12:59 AM

Displaying text color in postbit?
 
Playing around with custom profile fields, installing the ability for users to choose their gender. It works, but I think I want a postbit template conditional for making it display blue if they chose Male, and pink if they chose female.

Right now it displays like this:

https://vborg.vbsupport.ru/external/2014/05/22.jpg

Here's the bit from the postbit template, where we're calling this up:
Code:

<vb:if condition="$post['field12']"><dt>Gender</dt> <dd>{vb:raw post.field12}</dd></vb:if>
Any ideas? I want it to go more like "if gender =1 then blue and if gender =2 then pink"

kh99 05-17-2014 09:48 AM

I guess you want something like:
Code:

<vb:if condition="$post['field12']"><dt>Gender</dt> <dd style="color:<vb:if condition="$post['field12'] == 'Male'">blue<vb:else />pink</vb:if>" >{vb:raw post.field12}</dd></vb:if>

Max Taxable 05-17-2014 12:26 PM

That sure looks like it might work... I will have it tried and let you know.

Thanks Kevin!

Max Taxable 05-17-2014 12:56 PM

"Invalid tag nesting" error.

kh99 05-17-2014 01:57 PM

Yeah, there were a couple of problems with that. I shouldn't even try to post things without testing them first, I don't have a very good record. Anyway, I tried it and posted the fixed code above.

Max Taxable 05-17-2014 02:19 PM

U Da Man, thank you again!

Max Taxable 05-17-2014 07:11 PM

We made the color "HotPink" to get it to stand out more. Nicely done Kevin and again, thank you for the help.

kh99 05-17-2014 10:36 PM

Probably the "right" way to do it would be to change it to set a class based on the gender, then put CSS in additional.css to set the colors (and/or font, size, etc). Also that way you could have different colors per style if you wanted. But if it's doing what you want the way it is, I'd say that's fine.

Max Taxable 05-18-2014 01:03 AM

Quote:

Originally Posted by kh99 (Post 2498253)
Probably the "right" way to do it would be to change it to set a class based on the gender, then put CSS in additional.css to set the colors (and/or font, size, etc). Also that way you could have different colors per style if you wanted. But if it's doing what you want the way it is, I'd say that's fine.

I thought of that as well, but it was not as simple for the person I'm helping, and very difficult to explain.

This works for what they want, job well done.


All times are GMT. The time now is 04:06 AM.

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.01067 seconds
  • Memory Usage 1,726KB
  • 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_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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